Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c7f4b1690a | |||
| cc54016f3a | |||
| 07af655f36 | |||
| 45be7d3194 | |||
| b0d8f23b7b | |||
| 96e3d9f125 | |||
| 7750b0ddab | |||
| 53d6f50a0f | |||
| 9b9751ba31 | |||
| d7c1d4d7f8 | |||
| 4fd8be88e7 | |||
| d42a6366d3 | |||
| 6ef38695a2 | |||
| a48b1e39f6 | |||
| 32330c349c | |||
| f77f194f2e | |||
| c44ac7171c | |||
| 89507374e7 | |||
| 547173be40 | |||
| 634234677b | |||
| c7f5b99d34 | |||
| f5857e38f5 | |||
| c65e769e09 | |||
| 8ca8a76581 | |||
| ea7406c8bc | |||
| 571bc81584 | |||
| 803fc7df14 | |||
| 224421162c | |||
| 71f6bcb3d1 | |||
| e20853ea67 | |||
| d1f3ff282a | |||
| 84537d4761 | |||
| edb102cf45 | |||
| 97a2ea1135 | |||
| a15e077819 | |||
| c6611ca1b6 | |||
| 141b529c73 | |||
| f1929abc8b | |||
| 66f68f5ce9 | |||
| edb8c65d0f |
@@ -0,0 +1,270 @@
|
||||
name: Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
description: 'Branch, Tag or Commit to build'
|
||||
required: false
|
||||
default: 'master'
|
||||
apply_patches:
|
||||
description: 'Apply custom patches (Boolean)'
|
||||
required: false
|
||||
default: false
|
||||
|
||||
env:
|
||||
X264_VERSION: "0.161.3049"
|
||||
FFNVCODEC_VERSION: "n11.0.10.0"
|
||||
AMF_VERSION: "v1.4.18"
|
||||
ZLIB_NG_VERSION: "2.0.3"
|
||||
|
||||
jobs:
|
||||
cc:
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
license_version: [ 3, 2 ]
|
||||
license: [ "GPL", "LGPL" ]
|
||||
type: [ "shared" ]
|
||||
bits: [ 64 ]
|
||||
name: "Windows (${{ matrix.bits }}bit, ${{ matrix.type }}, ${{ matrix.license }}v${{ matrix.license_version}})"
|
||||
steps:
|
||||
- name: "automation: Check out"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: "recursive"
|
||||
fetch-depth: 0
|
||||
|
||||
- name: "automation: Copy patches to safe directory"
|
||||
if: ${{ github.event.inputs.apply_patches == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ -d ./patches ]]; then
|
||||
cp -a ./patches /tmp/
|
||||
fi
|
||||
|
||||
- name: "automation: Gather Information"
|
||||
id: data
|
||||
shell: bash
|
||||
run: |
|
||||
# Bitness
|
||||
if [ "${{ matrix.bits }}" == "32" ]; then
|
||||
echo "::set-output name=arch::i686"
|
||||
echo "::set-output name=target_os::mingw32"
|
||||
echo "::set-output name=cross_prefix::i686-w64-mingw32"
|
||||
else
|
||||
echo "::set-output name=arch::x86_64"
|
||||
echo "::set-output name=target_os::mingw64"
|
||||
echo "::set-output name=cross_prefix::x86_64-w64-mingw32"
|
||||
fi
|
||||
|
||||
# License (GPL vs LGPL, v2 vs v3)
|
||||
if [ "${{ matrix.license }}" == "GPL" ]; then
|
||||
echo "::set-output name=flags_license::--enable-gpl"
|
||||
fi
|
||||
if [ "${{ matrix.license_version }}" == "3" ]; then
|
||||
echo "::set-output name=flags_license_version::--enable-version3"
|
||||
fi
|
||||
|
||||
# Build Type
|
||||
if [ "${{ matrix.type }}" == "static" ]; then
|
||||
echo "::set-output name=flags_type::--enable-static --disable-shared"
|
||||
else
|
||||
echo "::set-output name=flags_type::--disable-static --enable-shared"
|
||||
fi
|
||||
|
||||
- name: "ffmpeg: Check out ${{ github.event.inputs.ref }}"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: "${{ github.event.inputs.ref }}"
|
||||
submodules: "recursive"
|
||||
fetch-depth: 0
|
||||
|
||||
- name: "automation: Detect version (and apply patches if necessary)"
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
# Detect Major.Minor.Patch version
|
||||
VERSION=( $(cat RELEASE | sed -E 's/\./ /gi') )
|
||||
VERSION_MAJOR=${VERSION[0]}
|
||||
VERSION_MINOR=${VERSION[1]}
|
||||
if (( ${#VERSION[@]} == 3 )); then
|
||||
VERSION_PATCH=${VERSION[2]}
|
||||
else
|
||||
VERSION_PATCH=0
|
||||
fi
|
||||
|
||||
COMMIT="$(git rev-parse --short=8 HEAD)"
|
||||
echo "FFmpeg v${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${COMMIT}"
|
||||
|
||||
# Apply available patches
|
||||
if [[ "${{ github.event.inputs.apply_patches}}" == "true" ]]; then
|
||||
echo "Applying custom patches:"
|
||||
|
||||
declare -a PATCHES
|
||||
if [[ "${{ github.event.inputs.ref }}" == "master" ]]; then
|
||||
PATCHES[${#PATCHES[@]}]="master"
|
||||
else
|
||||
PATCHES[${#PATCHES[@]}]="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
|
||||
PATCHES[${#PATCHES[@]}]="${VERSION_MAJOR}.${VERSION_MINOR}"
|
||||
PATCHES[${#PATCHES[@]}]="${VERSION_MAJOR}"
|
||||
fi
|
||||
|
||||
for p in ${PATCHES[@]}; do
|
||||
if [[ -d "/tmp/patches/${p}" ]]; then
|
||||
echo " Found patches for ${p}:"
|
||||
for f in /tmp/patches/${p}/*.patch; do
|
||||
echo " ${f}..."
|
||||
[ -e "$f" ] || continue
|
||||
git apply "$f"
|
||||
done
|
||||
else
|
||||
echo " No patches for ${p}."
|
||||
fi
|
||||
done
|
||||
|
||||
VERSION_PATCH="${VERSION_PATCH}.patched"
|
||||
fi
|
||||
|
||||
# Set Outputs
|
||||
echo "::set-output name=major::${VERSION_MAJOR}"
|
||||
echo "::set-output name=minor::${VERSION_MINOR}"
|
||||
echo "::set-output name=patch::${VERSION_PATCH}"
|
||||
echo "::set-output name=commit::${COMMIT}"
|
||||
|
||||
# Create distrib directory
|
||||
mkdir distrib
|
||||
mkdir distrib/bin
|
||||
mkdir distrib/lib
|
||||
mkdir distrib/include
|
||||
mkdir distrib/share
|
||||
|
||||
- name: "dependency: cmake, make, pkg-config, mingw, nasm"
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install \
|
||||
build-essential git \
|
||||
cmake make ninja-build \
|
||||
pkg-config \
|
||||
mingw-w64 mingw-w64-tools gcc-mingw-w64 g++-mingw-w64 \
|
||||
nasm
|
||||
|
||||
# zlib-ng
|
||||
- name: "dependency: zlib (zlib-ng v${{ env.ZLIB_NG_VERSION }}, Zlib license, shared)"
|
||||
id: zlib
|
||||
shell: bash
|
||||
run: |
|
||||
git clone --depth 1 --branch ${ZLIB_NG_VERSION} "https://github.com/zlib-ng/zlib-ng" /tmp/zlib-ng
|
||||
pushd "/tmp/zlib-ng" > /dev/null
|
||||
cmake -H. -Bbuild/build \
|
||||
-DCMAKE_TOOLCHAIN_FILE=./cmake/toolchain-mingw-${{ steps.data.outputs.arch }}.cmake \
|
||||
-DCMAKE_BUILD_TYPE=RELEASE -DZLIB_COMPAT=ON -DZLIB_ENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=./build/distrib/
|
||||
cmake --build build/build --target install
|
||||
pushd "./build/distrib" > /dev/null
|
||||
# Fix ZLIB_COMPAT=ON still adding a suffix.
|
||||
cp ./lib/libzlib.dll.a ./lib/libz.dll.a
|
||||
|
||||
# Generate MSVC compatible .lib file
|
||||
gendef - ./bin/libzlib1.dll > ./lib/libzlib.def
|
||||
${{ steps.data.outputs.cross_prefix }}-dlltool -d ./lib/libzlib.def -l ./lib/libzlib.lib
|
||||
cp ./lib/libzlib.lib ./lib/libz.lib
|
||||
popd > /dev/null
|
||||
popd > /dev/null
|
||||
sudo cp -a /tmp/zlib-ng/build/distrib/. /usr/${{ steps.data.outputs.cross_prefix }}
|
||||
cp -a /tmp/zlib-ng/build/distrib/bin/*.dll ./distrib/bin/
|
||||
|
||||
# libx264 (FFmpeg 0.5 and up, arbitrarily limited to 1.0 because I'm lazy)
|
||||
- name: "dependency: x264 v${{ env.X264_VERSION }} (GPLv2, shared)"
|
||||
if: ${{ (steps.version.outputs.major >= 1) && startsWith(matrix.license, 'GPL') }}
|
||||
id: x264
|
||||
shell: bash
|
||||
run: |
|
||||
curl -L -o "/tmp/x264.zip" "https://github.com/Xaymar/x264/releases/download/${X264_VERSION}/x264-${{ matrix.bits }}-shared-GPLv2.zip"
|
||||
7z x -o/tmp/x264/ "/tmp/x264.zip"
|
||||
sudo cp -a /tmp/x264/. /usr/${{ steps.data.outputs.cross_prefix }}/
|
||||
cp -a /tmp/x264/bin/*.dll ./distrib/bin/
|
||||
echo "::set-output name=flags::--enable-libx264"
|
||||
|
||||
# NVIDIA Codec Headers (FFmpeg 3.0 and up)
|
||||
- name: "dependency: NVIDIA Codec Headers v${{ env.FFNVCODEC_VERSION }} (MIT, shared)"
|
||||
if: ${{ steps.version.outputs.major >= 3 }}
|
||||
id: ffnvcodec
|
||||
shell: bash
|
||||
run: |
|
||||
git clone --depth 1 --branch ${FFNVCODEC_VERSION} "https://git.videolan.org/git/ffmpeg/nv-codec-headers.git" /tmp/nv-codec-headers
|
||||
pushd "/tmp/nv-codec-headers" > /dev/null
|
||||
make PREFIX=/usr/${{ steps.data.outputs.cross_prefix }}
|
||||
sudo make PREFIX=/usr/${{ steps.data.outputs.cross_prefix }} install
|
||||
popd > /dev/null
|
||||
|
||||
if (( "${{ steps.version.outputs.major }}" >= 4 )); then
|
||||
echo "::set-output name=flags::--enable-ffnvcodec --enable-nvdec --enable-cuvid --enable-nvenc"
|
||||
elif (( "${{ steps.version.outputs.major }}" >= 3 )); then
|
||||
if (( "${{ steps.version.outputs.minor }}" >= 2 )); then
|
||||
# 3.2+ has cuda, cuvid, nvenc
|
||||
echo "::set-output name=flags::--enable-cuvid --enable-nvenc"
|
||||
elif (( "${{ steps.version.outputs.minor }}" >= 1 )); then
|
||||
# 3.1 has cuda, nvenc
|
||||
echo "::set-output name=flags::--enable-nvenc"
|
||||
elif (( "${{ steps.version.outputs.minor }}" >= 0 )); then
|
||||
# 3.0 has nvenc
|
||||
echo "::set-output name=flags::--enable-nvenc"
|
||||
fi
|
||||
fi
|
||||
|
||||
# AMD AMF (FFmpeg 4.0 and up)
|
||||
- name: "dependency: AMD AMF (v${{ env.AMF_VERSION }}, MIT, shared)"
|
||||
if: ${{ steps.version.outputs.major >= 4 }}
|
||||
id: amf
|
||||
shell: bash
|
||||
run: |
|
||||
git clone --depth 1 --branch ${AMF_VERSION} "https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git" /tmp/amd-amf
|
||||
pushd "/tmp/amd-amf"
|
||||
sudo cp -R amf/public/include/ /usr/${{ steps.data.outputs.cross_prefix }}/include/AMF
|
||||
popd
|
||||
|
||||
if (( "${{ steps.version.outputs.major }}" >= 4 )); then
|
||||
echo "::set-output name=flags::--enable-amf"
|
||||
fi
|
||||
|
||||
# Configure FFmpeg
|
||||
- name: "ffmpeg: Configure"
|
||||
shell: bash
|
||||
run: |
|
||||
export PKG_CONFIG_PATH=/usr/${{ steps.data.outputs.cross_prefix }}/lib/pkgconfig:${PKG_CONFIG_PATH}
|
||||
./configure \
|
||||
--arch=${{ steps.data.outputs.arch }} \
|
||||
--target-os=${{ steps.data.outputs.target_os }} \
|
||||
--cross-prefix=${{ steps.data.outputs.cross_prefix }}- \
|
||||
--prefix="${{ github.workspace }}/distrib" \
|
||||
--bindir="${{ github.workspace }}/distrib/bin" \
|
||||
--libdir="${{ github.workspace }}/distrib/lib" \
|
||||
--shlibdir="${{ github.workspace }}/distrib/bin" \
|
||||
--pkg-config=pkg-config \
|
||||
--extra-cflags=-O3 --extra-cflags=-mmmx --extra-cflags=-msse --extra-cflags=-msse2 --extra-cflags=-msse3 --extra-cflags=-mssse3 \
|
||||
--extra-cflags=-msse4.1 --extra-cflags=-msse4.2 --extra-cflags=-mavx --extra-cflags=-maes --extra-cflags=-mpclmul \
|
||||
--pkg-config=pkg-config \
|
||||
${{ steps.data.outputs.flags_license }} ${{ steps.data.outputs.flags_license_version }} \
|
||||
${{ steps.data.outputs.flags_type }} \
|
||||
${{ steps.x264.outputs.flags }} \
|
||||
${{ steps.ffnvcodec.outputs.flags }} \
|
||||
${{ steps.amf.outputs.flags }}
|
||||
|
||||
- name: "ffmpeg: Compile"
|
||||
shell: bash
|
||||
run: |
|
||||
make -j 4
|
||||
|
||||
- name: "ffmpeg: Install"
|
||||
shell: bash
|
||||
run: |
|
||||
make install
|
||||
# Move .lib files which are in the wrong place.
|
||||
mv ./distrib/bin/*.lib ./distrib/lib/
|
||||
|
||||
- name: "automation: Upload Artifacts"
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: ffmpeg-${{ matrix.bits }}-${{ matrix.type }}-${{ matrix.license }}v${{ matrix.license_version }}-${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}-${{ steps.version.outputs.commit }}
|
||||
path: distrib
|
||||
@@ -0,0 +1,125 @@
|
||||
name: Refresh
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
push:
|
||||
branches:
|
||||
- 'automation'
|
||||
- 'automation-test'
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
name: "Update Mirror"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
name: "Checkout"
|
||||
- name: "Configure"
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global user.name 'GitHub Actions'
|
||||
git config --global user.email 'xaymar@users.noreply.github.com'
|
||||
git config pull.ff only
|
||||
git config pull.rebase true
|
||||
- name: "Remotes"
|
||||
if: ${{ github.event_name == 'schedule' }}
|
||||
shell: bash
|
||||
run: |
|
||||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
||||
git remote add -f --tags remote https://git.ffmpeg.org/ffmpeg.git
|
||||
git fetch --all
|
||||
- name: "Synchronize with Remote and trigger Builds"
|
||||
if: ${{ github.event_name == 'schedule' }}
|
||||
shell: bash
|
||||
run: |
|
||||
declare -a BRANCHES
|
||||
BRANCHES[${#BRANCHES[@]}]="master"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/4.4"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/4.3"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/4.2"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/4.1"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/4.0"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/3.4"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/3.3"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/3.2"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/3.1"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/3.0"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/2.8"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/2.7"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/2.6"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/2.5"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/2.4"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/2.3"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/2.2"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/2.1"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/2.0"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/1.2"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/1.1"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/1.0"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/0.11"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/0.10"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/0.9"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/0.8"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/0.7"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/0.6"
|
||||
BRANCHES[${#BRANCHES[@]}]="release/0.5"
|
||||
BRANCHES[${#BRANCHES[@]}]="oldabi"
|
||||
|
||||
echo "Testing branches for differences..."
|
||||
for d in ${BRANCHES[@]}; do
|
||||
BRANCH_REQUIRES_UPDATE=false
|
||||
if ! git branch -a | grep origin/${d} > /dev/null; then
|
||||
echo " '${d}' is missing, creating..."
|
||||
BRANCH_REQUIRES_UPDATE=true
|
||||
elif ! git diff -s --exit-code origin/${d} remote/${d} > /dev/null; then
|
||||
echo " '${d}' is out of date, updating..."
|
||||
BRANCH_REQUIRES_UPDATE=true
|
||||
fi
|
||||
|
||||
# Always check out the remote branch.
|
||||
git checkout -b "${d}" "remote/${d}" > /dev/null
|
||||
|
||||
if ${BRANCH_REQUIRES_UPDATE}; then
|
||||
git push --follow-tags --set-upstream origin ${d}
|
||||
|
||||
# Trigger build without custom patches
|
||||
curl -s --show-error \
|
||||
-X POST \
|
||||
-H "Authorization: token ${{ secrets.WORKFLOW_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-d "{\"ref\":\"${{ github.ref }}\",\"inputs\":{\"ref\":\"${d}\"}}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/build.yml/dispatches"
|
||||
|
||||
# Trigger build with custom patches
|
||||
curl -s --show-error \
|
||||
-X POST \
|
||||
-H "Authorization: token ${{ secrets.WORKFLOW_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-d "{\"ref\":\"${{ github.ref }}\",\"inputs\":{\"ref\":\"${d}\",\"apply_patches\":\"true\"}}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/build.yml/dispatches"
|
||||
fi
|
||||
done
|
||||
- name: "Only trigger build on manual push"
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
shell: bash
|
||||
run: |
|
||||
declare -a BRANCHES
|
||||
BRANCHES[${#BRANCHES[@]}]="master"
|
||||
|
||||
for d in ${BRANCHES[@]}; do
|
||||
# Trigger build without custom patches
|
||||
curl -s --show-error \
|
||||
-X POST \
|
||||
-H "Authorization: token ${{ secrets.WORKFLOW_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-d "{\"ref\":\"${{ github.ref }}\",\"inputs\":{\"ref\":\"${d}\"}}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/build.yml/dispatches"
|
||||
|
||||
# Trigger build with custom patches
|
||||
curl -s --show-error \
|
||||
-X POST \
|
||||
-H "Authorization: token ${{ secrets.WORKFLOW_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-d "{\"ref\":\"${{ github.ref }}\",\"inputs\":{\"ref\":\"${d}\",\"apply_patches\":\"true\"}}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/build.yml/dispatches"
|
||||
done
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
.config
|
||||
.version
|
||||
*.o
|
||||
*.so
|
||||
*.d
|
||||
*.exe
|
||||
*.ho
|
||||
*-example
|
||||
*-test
|
||||
*_g
|
||||
config.*
|
||||
doc/*.1
|
||||
doc/*.html
|
||||
doc/*.pod
|
||||
doxy
|
||||
ffmpeg
|
||||
ffplay
|
||||
ffprobe
|
||||
ffserver
|
||||
libavcodec/libavcodec*
|
||||
libavcore/libavcore*
|
||||
libavdevice/libavdevice*
|
||||
libavfilter/libavfilter*
|
||||
libavformat/libavformat*
|
||||
libavutil/avconfig.h
|
||||
libavutil/libavutil*
|
||||
libpostproc/libpostproc*
|
||||
libswscale/libswscale*
|
||||
tests/audiogen
|
||||
tests/base64
|
||||
tests/data
|
||||
tests/rotozoom
|
||||
tests/seek_test
|
||||
tests/tiny_psnr
|
||||
tests/videogen
|
||||
tests/vsynth1
|
||||
tests/vsynth2
|
||||
tools/cws2fws
|
||||
tools/graph2dot
|
||||
tools/lavfi-showfiltfmts
|
||||
tools/pktdumper
|
||||
tools/probetest
|
||||
tools/qt-faststart
|
||||
tools/trasher
|
||||
tools/trasher*.d
|
||||
version.h
|
||||
-339
@@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 02110-1301 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.
|
||||
|
||||
<signature of Ty Coon>, 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 Lesser General
|
||||
Public License instead of this License.
|
||||
-674
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. 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
|
||||
them 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 prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. 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.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey 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;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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 that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
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.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
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.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
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
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program 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, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU 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 Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -1,504 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
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 and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, 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 library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
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 distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
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 Library or any portion
|
||||
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
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 Library, 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 Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you 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.
|
||||
|
||||
If distribution of 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 satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be 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.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library 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.
|
||||
|
||||
9. 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 Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
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 with
|
||||
this License.
|
||||
|
||||
11. 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 Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library 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 Library.
|
||||
|
||||
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.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library 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.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser 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 Library
|
||||
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 Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
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
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. 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 LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. 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.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
-165
@@ -1,165 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser 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
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
@@ -1,50 +0,0 @@
|
||||
This file contains the name of the people who have contributed to
|
||||
FFmpeg. The names are sorted alphabetically by last name.
|
||||
|
||||
Dénes Balatoni
|
||||
Michel Bardiaux
|
||||
Fabrice Bellard
|
||||
Patrice Bensoussan
|
||||
Alex Beregszaszi
|
||||
BERO
|
||||
Mario Brito
|
||||
Ronald Bultje
|
||||
Maarten Daniels
|
||||
Reimar Doeffinger
|
||||
Tim Ferguson
|
||||
Brian Foley
|
||||
Arpad Gereoffy
|
||||
Philip Gladstone
|
||||
Vladimir Gneushev
|
||||
Roine Gustafsson
|
||||
David Hammerton
|
||||
Wolfgang Hesseler
|
||||
Marc Hoffman
|
||||
Falk Hueffner
|
||||
Aurélien Jacobs
|
||||
Steven Johnson
|
||||
Zdenek Kabelac
|
||||
Robin Kay
|
||||
Todd Kirby
|
||||
Nick Kurshev
|
||||
Benjamin Larsson
|
||||
Loïc Le Loarer
|
||||
Daniel Maas
|
||||
Mike Melanson
|
||||
Loren Merritt
|
||||
Jeff Muizelaar
|
||||
Michael Niedermayer
|
||||
François Revol
|
||||
Peter Ross
|
||||
Måns Rullgård
|
||||
Roman Shaposhnik
|
||||
Oded Shimon
|
||||
Dieter Shirley
|
||||
Konstantin Shishkov
|
||||
Juan J. Sierralta
|
||||
Ewald Snel
|
||||
Sascha Sommer
|
||||
Leon van Stuivenberg
|
||||
Roberto Togni
|
||||
Lionel Ulmer
|
||||
Reynaldo Verdejo
|
||||
@@ -1,629 +0,0 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 0.5.10:
|
||||
|
||||
- mpeg12: do not decode extradata more than once (CVE-2012-2803)
|
||||
- vp6: properly fail on unsupported feature (CVE-2012-2783)
|
||||
- vp56: release frames on error (CVE-2012-2783)
|
||||
- shorten: Use separate pointers for the allocated memory for decoded samples (CVE-2012-0858)
|
||||
- shorten: check for realloc failure
|
||||
- h264: check context state before decoding slice data partitions
|
||||
- oggdec: check memory allocation
|
||||
- Fix uninitialized reads on malformed Ogg files
|
||||
- lavf: avoid integer overflow in ff_compute_frame_duration()
|
||||
- yuv4mpeg: reject unsupported codecs
|
||||
- tiffenc: Check av_malloc() results
|
||||
- mpegaudiodec: fix short_start calculation
|
||||
- h264: avoid stuck buffer pointer in decode_nal_units
|
||||
- yuv4mpeg: return proper error codes (Bug 373)
|
||||
- avidec: return 0, not packet size from read_packet()
|
||||
- cavsdec: check for changing w/h (CVE-2012-2777 and CVE-2012-2784)
|
||||
- avidec: use actually read size instead of requested size CVE-2012-2788
|
||||
- bytestream: add a new set of bytestream functions with overread checking
|
||||
- avsdec: Set dimensions instead of relying on the demuxer (CVE-2012-2801)
|
||||
- lavfi: avfilter_merge_formats: handle case where inputs are same
|
||||
- bmpdec: only initialize palette for pal8 (Bug 367)
|
||||
- Bump version number for the 0.5.10 release
|
||||
- lavfi: avfilter_merge_formats: handle case where inputs are same
|
||||
- mpegvideo: Don't use ff_mspel_motion() for vc1
|
||||
- imgconvert: avoid undefined left shift in avcodec_find_best_pix_fmt
|
||||
- nuv: check RTjpeg header for validity
|
||||
- vc1dec: add flush function for WMV9 and VC-1 decoders
|
||||
|
||||
|
||||
version 0.5.9:
|
||||
|
||||
- dpcm: ignore extra unpaired bytes in stereo streams (CVE-2011-3951)
|
||||
- h264: Add check for invalid chroma_format_idc (CVE-2012-0851)
|
||||
- adpcm: ADPCM Electronic Arts has always two channels (CVE-2012-0852)
|
||||
- kmvc: Check palsize (CVE-2011-3952)
|
||||
- qdm2: clip array indices returned by qdm2_get_vlc()
|
||||
- configure: properly check for mingw-w64 through installed headers
|
||||
- Replace every usage of -lvfw32 with what is particularly necessary for that case
|
||||
- mingw32: properly check if vfw capture is supported by the system headers
|
||||
- mingw32: merge checks for mingw-w64 and mingw32-runtime >= 3.15 into one
|
||||
- vfwcap: Include windows.h before vfw.h since the latter requires defines from the former
|
||||
- ea: check chunk_size for validity
|
||||
- eatqi: move "block" variable into context to ensure sufficient alignment for idct_put
|
||||
- tqi: Pass errors from the MB decoder
|
||||
- png: check bit depth for PAL8/Y400A pixel formats.
|
||||
|
||||
|
||||
version 0.5.8:
|
||||
|
||||
- id3v2: fix skipping extended header in id3v2.4
|
||||
- nsvdec: Several bugfixes related to CVE-2011-3940
|
||||
- dv: check stype
|
||||
- dv: Fix null pointer dereference due to ach=0
|
||||
- dv: Fix small stack overread related to CVE-2011-3929 and CVE-2011-3936.
|
||||
- atrac3: Fix crash in tonal component decoding, fixes CVE-2012-0853
|
||||
- mjpegbdec: Fix overflow in SOS, fixes CVE-2011-3947
|
||||
- motionpixels: Clip YUV values after applying a gradient.
|
||||
- vqavideo: return error if image size is not a multiple of block size,
|
||||
fixes CVE-2012-0947.
|
||||
|
||||
|
||||
version 0.5.7:
|
||||
- vorbis: An additional defense in the Vorbis codec. (CVE-2011-3895)
|
||||
- vorbisdec: Fix decoding bug with channel handling.
|
||||
- matroskadec: Fix a bug where a pointer was cached to an array that might
|
||||
later move due to a realloc(). (CVE-2011-3893)
|
||||
- vorbis: Avoid some out-of-bounds reads. (CVE-2011-3893)
|
||||
- vp3: fix oob read for negative tokens and memleaks on error, (CVE-2011-3892)
|
||||
- vp3: fix streams with non-zero last coefficient.
|
||||
|
||||
|
||||
version 0.5.6:
|
||||
- svq1dec: call avcodec_set_dimensions() after dimensions changed. (NGS00148, CVE-2011-4579)
|
||||
- vmd: fix segfaults on corruped streams (CVE-2011-4364)
|
||||
- commits related to CVE-2011-4353:
|
||||
- vp6: partially propagate huffman tree building errors during coeff model parsing and fix misspelling
|
||||
- Plug some memory leaks in the VP6 decoder
|
||||
- vp6: Reset the internal state when aborting key frames header parsing
|
||||
- vp6: Fix illegal read.
|
||||
- vp6: Fix illegal read.
|
||||
- Fix out of bound reads in the QDM2 decoder.
|
||||
- commits related to CVE-2011-4351:
|
||||
- Check for out of bound writes in the QDM2 decoder.
|
||||
- qdm2: check output buffer size before decoding
|
||||
- Fix qdm2 decoder packet handling to match the api
|
||||
|
||||
|
||||
version 0.5.5:
|
||||
|
||||
- Fix memory (re)allocation in matroskadec.c (MSVR11-011/CVE-2011-3504)
|
||||
- Fix some crashes with invalid bitstreams in the CAVS decoder
|
||||
(CVE-2011-3362, CVE-2011-3973, CVE-2011-3974)
|
||||
- Compilation fixes for gcc-4.6, testsuite now passes again
|
||||
- Detect and handle overreads in the MJPEG decoder.
|
||||
- multiple other security fixes.
|
||||
|
||||
|
||||
|
||||
version 0.5.4:
|
||||
|
||||
- Fix memory corruption in WMV parsing (addresses CVE-2010-3908)
|
||||
- Fix heap corruption crashes (addresses CVE-2011-0722)
|
||||
- Fix crashes in Vorbis decoding found by zzuf (addresses CVE-2010-4704)
|
||||
- Fix another crash in Vorbis decoding (addresses CVE-2011-0480, Chrome issue 68115)
|
||||
- Fix invalid reads in VC-1 decoding (related to CVE-2011-0723)
|
||||
- Do not attempt to decode APE file with no frames
|
||||
(adresses http://packetstorm.linuxsecurity.com/1103-exploits/vlc105-dos.txt)
|
||||
|
||||
|
||||
|
||||
version 0.5.3:
|
||||
|
||||
- build system improvements
|
||||
- performance fix for seekable HTTP
|
||||
- fix several potentially exploitable issues in the FLIC decoder
|
||||
(addresses CVE-2010-3429)
|
||||
|
||||
|
||||
|
||||
version 0.5.2:
|
||||
|
||||
- Hurd support
|
||||
- PowerPC without AltiVec compilation issues
|
||||
- validate channels and samplerate in the Vorbis decoder
|
||||
|
||||
|
||||
|
||||
version 0.5.1:
|
||||
|
||||
- build system updates
|
||||
- documentation updates
|
||||
- libswscale now is LGPL except for x86 optimizations
|
||||
- fix for GPL code in libswscale that was erroneously activated
|
||||
- AltiVec code in libswscale is now LGPL
|
||||
- remaining GPL parts in AC-3 decoder converted to LGPL
|
||||
- (L)GPL license upgrade support
|
||||
- AMR-NB decoding/encoding, AMR-WB decoding via OpenCORE libraries
|
||||
- enable symbol versioning by default for linkers that support it
|
||||
- backport av_lockmgr_register(), see doc/APIchanges for details
|
||||
- security fixes for:
|
||||
- ASF, Ogg and MOV demuxers
|
||||
- FFv1, H.264, HuffYUV, MLP, MPEG audio and Snow decoders
|
||||
|
||||
|
||||
|
||||
version 0.5:
|
||||
|
||||
- The "device" muxers and demuxers are now in a new libavdevice library
|
||||
- DV50 AKA DVCPRO50 encoder, decoder, muxer and demuxer
|
||||
- DV100 AKA DVCPRO HD decoder and demuxer
|
||||
- TechSmith Camtasia (TSCC) video decoder
|
||||
- IBM Ultimotion (ULTI) video decoder
|
||||
- Sierra Online audio file demuxer and decoder
|
||||
- Apple QuickDraw (qdrw) video decoder
|
||||
- Creative ADPCM audio decoder (16 bits as well as 8 bits schemes)
|
||||
- Electronic Arts Multimedia (WVE/UV2/etc.) file demuxer
|
||||
- Miro VideoXL (VIXL) video decoder
|
||||
- H.261 video encoder
|
||||
- QPEG video decoder
|
||||
- Nullsoft Video (NSV) file demuxer
|
||||
- Shorten audio decoder
|
||||
- LOCO video decoder
|
||||
- Apple Lossless Audio Codec (ALAC) decoder
|
||||
- Winnov WNV1 video decoder
|
||||
- Autodesk Animator Studio Codec (AASC) decoder
|
||||
- Indeo 2 video decoder
|
||||
- Fraps FPS1 video decoder
|
||||
- Snow video encoder/decoder
|
||||
- Sonic audio encoder/decoder
|
||||
- Vorbis audio encoder/decoder
|
||||
- Macromedia ADPCM decoder
|
||||
- Duck TrueMotion 2 video decoder
|
||||
- support for decoding FLX and DTA extensions in FLIC files
|
||||
- H.264 custom quantization matrices support
|
||||
- ffserver fixed, it should now be usable again
|
||||
- QDM2 audio decoder
|
||||
- Real Cooker audio decoder
|
||||
- TrueSpeech audio decoder
|
||||
- WMA2 audio decoder fixed, now all files should play correctly
|
||||
- RealAudio 14.4 and 28.8 decoders fixed
|
||||
- JPEG-LS encoder and decoder
|
||||
- CamStudio video decoder
|
||||
- build system improvements
|
||||
- tabs and trailing whitespace removed from the codebase
|
||||
- AIFF/AIFF-C audio format, encoding and decoding
|
||||
- ADTS AAC file reading and writing
|
||||
- Creative VOC file reading and writing
|
||||
- American Laser Games multimedia (*.mm) playback system
|
||||
- Zip Blocks Motion Video decoder and encoder
|
||||
- improved Theora/VP3 decoder
|
||||
- True Audio (TTA) decoder
|
||||
- AVS demuxer and video decoder
|
||||
- Smacker demuxer and decoder
|
||||
- NuppelVideo/MythTV demuxer and RTjpeg decoder
|
||||
- KMVC decoder
|
||||
- MPEG-2 intra VLC support
|
||||
- MPEG-2 4:2:2 encoder
|
||||
- Flash Screen Video decoder
|
||||
- GXF demuxer
|
||||
- Chinese AVS decoder
|
||||
- GXF muxer
|
||||
- MXF demuxer
|
||||
- VC-1/WMV3/WMV9 video decoder
|
||||
- MacIntel support
|
||||
- AVISynth support
|
||||
- VMware video decoder
|
||||
- VP5 video decoder
|
||||
- VP6 video decoder
|
||||
- WavPack lossless audio decoder
|
||||
- Targa (.TGA) picture decoder
|
||||
- Delphine Software .cin demuxer/audio and video decoder
|
||||
- Tiertex .seq demuxer/video decoder
|
||||
- MTV demuxer
|
||||
- TIFF picture encoder and decoder
|
||||
- GIF picture decoder
|
||||
- Intel Music Coder decoder
|
||||
- Musepack decoder
|
||||
- Flash Screen Video encoder
|
||||
- Theora encoding via libtheora
|
||||
- BMP encoder
|
||||
- WMA encoder
|
||||
- GSM-MS encoder and decoder
|
||||
- DCA decoder
|
||||
- DXA demuxer and decoder
|
||||
- DNxHD decoder
|
||||
- Gamecube movie (.THP) playback system
|
||||
- Blackfin optimizations
|
||||
- Interplay C93 demuxer and video decoder
|
||||
- Bethsoft VID demuxer and video decoder
|
||||
- CRYO APC demuxer
|
||||
- Atrac3 decoder
|
||||
- V.Flash PTX decoder
|
||||
- RoQ muxer, RoQ audio encoder
|
||||
- Renderware TXD demuxer and decoder
|
||||
- extern C declarations for C++ removed from headers
|
||||
- sws_flags command line option
|
||||
- codebook generator
|
||||
- RoQ video encoder
|
||||
- QTRLE encoder
|
||||
- OS/2 support removed and restored again
|
||||
- AC-3 decoder
|
||||
- NUT muxer
|
||||
- Matroska muxer
|
||||
- slice-based parallel H.264 decoding
|
||||
- Monkey's Audio demuxer and decoder
|
||||
- additional SPARC (VIS) optimizations
|
||||
- AMV audio and video decoder
|
||||
- DNxHD encoder
|
||||
- H.264 PAFF decoding
|
||||
- Nellymoser ASAO decoder
|
||||
- Beam Software SIFF demuxer and decoder
|
||||
- libvorbis Vorbis decoding removed in favor of native decoder
|
||||
- IntraX8 (J-Frame) subdecoder for WMV2 and VC-1
|
||||
- Ogg (Theora, Vorbis and FLAC) muxer
|
||||
- PC Paintbrush PCX decoder
|
||||
- Sun Rasterfile decoder
|
||||
- TechnoTrend PVA demuxer
|
||||
- Linux Media Labs MPEG-4 (LMLM4) demuxer
|
||||
- AVM2 (Flash 9) SWF muxer
|
||||
- QT variant of IMA ADPCM encoder
|
||||
- VFW grabber
|
||||
- iPod/iPhone compatible mp4 muxer
|
||||
- Mimic decoder
|
||||
- MSN TCP Webcam stream demuxer
|
||||
- RL2 demuxer / decoder
|
||||
- IFF demuxer
|
||||
- 8SVX audio decoder
|
||||
- non-recursive Makefiles
|
||||
- BFI demuxer
|
||||
- MAXIS EA XA (.xa) demuxer / decoder
|
||||
- BFI video decoder
|
||||
- OMA demuxer
|
||||
- MLP/TrueHD decoder
|
||||
- Electronic Arts CMV decoder
|
||||
- Motion Pixels Video decoder
|
||||
- Motion Pixels MVI demuxer
|
||||
- removed animated GIF decoder/demuxer
|
||||
- D-Cinema audio muxer
|
||||
- Electronic Arts TGV decoder
|
||||
- Apple Lossless Audio Codec (ALAC) encoder
|
||||
- AAC decoder
|
||||
- floating point PCM encoder/decoder
|
||||
- MXF muxer
|
||||
- E-AC-3 support added to AC-3 decoder
|
||||
- Nellymoser ASAO encoder
|
||||
- ASS and SSA demuxer and muxer
|
||||
- liba52 wrapper removed
|
||||
- SVQ3 watermark decoding support
|
||||
- Speex decoding via libspeex
|
||||
- Electronic Arts TGQ decoder
|
||||
- RV30 and RV40 decoder
|
||||
- QCELP / PureVoice decoder
|
||||
- hybrid WavPack support
|
||||
- R3D REDCODE demuxer
|
||||
- ALSA support for playback and record
|
||||
- Electronic Arts TQI decoder
|
||||
- OpenJPEG based JPEG 2000 decoder
|
||||
- NC (NC4600) camera file demuxer
|
||||
- Gopher client support
|
||||
- MXF D-10 muxer
|
||||
- generic metadata API
|
||||
|
||||
|
||||
version 0.4.9-pre1:
|
||||
|
||||
- DV encoder, DV muxer
|
||||
- Microsoft RLE video decoder
|
||||
- Microsoft Video-1 decoder
|
||||
- Apple Animation (RLE) decoder
|
||||
- Apple Graphics (SMC) decoder
|
||||
- Apple Video (RPZA) decoder
|
||||
- Cinepak decoder
|
||||
- Sega FILM (CPK) file demuxer
|
||||
- Westwood multimedia support (VQA & AUD files)
|
||||
- Id Quake II CIN playback support
|
||||
- 8BPS video decoder
|
||||
- FLIC playback support
|
||||
- RealVideo 2.0 (RV20) decoder
|
||||
- Duck TrueMotion v1 (DUCK) video decoder
|
||||
- Sierra VMD demuxer and video decoder
|
||||
- MSZH and ZLIB decoder support
|
||||
- SVQ1 video encoder
|
||||
- AMR-WB support
|
||||
- PPC optimizations
|
||||
- rate distortion optimal cbp support
|
||||
- rate distorted optimal ac prediction for MPEG-4
|
||||
- rate distorted optimal lambda->qp support
|
||||
- AAC encoding with libfaac
|
||||
- Sunplus JPEG codec (SP5X) support
|
||||
- use Lagrange multipler instead of QP for ratecontrol
|
||||
- Theora/VP3 decoding support
|
||||
- XA and ADX ADPCM codecs
|
||||
- export MPEG-2 active display area / pan scan
|
||||
- Add support for configuring with IBM XLC
|
||||
- floating point AAN DCT
|
||||
- initial support for zygo video (not complete)
|
||||
- RGB ffv1 support
|
||||
- new audio/video parser API
|
||||
- av_log() system
|
||||
- av_read_frame() and av_seek_frame() support
|
||||
- missing last frame fixes
|
||||
- seek by mouse in ffplay
|
||||
- noise reduction of DCT coefficients
|
||||
- H.263 OBMC & 4MV support
|
||||
- H.263 alternative inter vlc support
|
||||
- H.263 loop filter
|
||||
- H.263 slice structured mode
|
||||
- interlaced DCT support for MPEG-2 encoding
|
||||
- stuffing to stay above min_bitrate
|
||||
- MB type & QP visualization
|
||||
- frame stepping for ffplay
|
||||
- interlaced motion estimation
|
||||
- alternate scantable support
|
||||
- SVCD scan offset support
|
||||
- closed GOP support
|
||||
- SSE2 FDCT
|
||||
- quantizer noise shaping
|
||||
- G.726 ADPCM audio codec
|
||||
- MS ADPCM encoding
|
||||
- multithreaded/SMP motion estimation
|
||||
- multithreaded/SMP encoding for MPEG-1/MPEG-2/MPEG-4/H.263
|
||||
- multithreaded/SMP decoding for MPEG-2
|
||||
- FLAC decoder
|
||||
- Metrowerks CodeWarrior suppport
|
||||
- H.263+ custom pcf support
|
||||
- nicer output for 'ffmpeg -formats'
|
||||
- Matroska demuxer
|
||||
- SGI image format, encoding and decoding
|
||||
- H.264 loop filter support
|
||||
- H.264 CABAC support
|
||||
- nicer looking arrows for the motion vector visualization
|
||||
- improved VCD support
|
||||
- audio timestamp drift compensation
|
||||
- MPEG-2 YUV 422/444 support
|
||||
- polyphase kaiser windowed sinc and blackman nuttall windowed sinc audio resample
|
||||
- better image scaling
|
||||
- H.261 support
|
||||
- correctly interleave packets during encoding
|
||||
- VIS optimized motion compensation
|
||||
- intra_dc_precision>0 encoding support
|
||||
- support reuse of motion vectors/MB types/field select values of the source video
|
||||
- more accurate deblock filter
|
||||
- padding support
|
||||
- many optimizations and bugfixes
|
||||
- FunCom ISS audio file demuxer and according ADPCM decoding
|
||||
|
||||
version 0.4.8:
|
||||
|
||||
- MPEG-2 video encoding (Michael)
|
||||
- Id RoQ playback subsystem (Mike Melanson and Tim Ferguson)
|
||||
- Wing Commander III Movie (.mve) file playback subsystem (Mike Melanson
|
||||
and Mario Brito)
|
||||
- Xan DPCM audio decoder (Mario Brito)
|
||||
- Interplay MVE playback subsystem (Mike Melanson)
|
||||
- Duck DK3 and DK4 ADPCM audio decoders (Mike Melanson)
|
||||
|
||||
version 0.4.7:
|
||||
|
||||
- RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from mplayerhq
|
||||
(originally from public domain player for Amiga at http://www.honeypot.net/audio)
|
||||
- current version now also compiles with older GCC (Fabrice)
|
||||
- 4X multimedia playback system including 4xm file demuxer (Mike
|
||||
Melanson), and 4X video and audio codecs (Michael)
|
||||
- Creative YUV (CYUV) decoder (Mike Melanson)
|
||||
- FFV1 codec (our very simple lossless intra only codec, compresses much better
|
||||
than HuffYUV) (Michael)
|
||||
- ASV1 (Asus), H.264, Intel indeo3 codecs have been added (various)
|
||||
- tiny PNG encoder and decoder, tiny GIF decoder, PAM decoder (PPM with
|
||||
alpha support), JPEG YUV colorspace support. (Fabrice Bellard)
|
||||
- ffplay has been replaced with a newer version which uses SDL (optionally)
|
||||
for multiplatform support (Fabrice)
|
||||
- Sorenson Version 3 codec (SVQ3) support has been added (decoding only) - donated
|
||||
by anonymous
|
||||
- AMR format has been added (Johannes Carlsson)
|
||||
- 3GP support has been added (Johannes Carlsson)
|
||||
- VP3 codec has been added (Mike Melanson)
|
||||
- more MPEG-1/2 fixes
|
||||
- better multiplatform support, MS Visual Studio fixes (various)
|
||||
- AltiVec optimizations (Magnus Damn and others)
|
||||
- SH4 processor support has been added (BERO)
|
||||
- new public interfaces (avcodec_get_pix_fmt) (Roman Shaposhnick)
|
||||
- VOB streaming support (Brian Foley)
|
||||
- better MP3 autodetection (Andriy Rysin)
|
||||
- qpel encoding (Michael)
|
||||
- 4mv+b frames encoding finally fixed (Michael)
|
||||
- chroma ME (Michael)
|
||||
- 5 comparison functions for ME (Michael)
|
||||
- B-frame encoding speedup (Michael)
|
||||
- WMV2 codec (unfinished - Michael)
|
||||
- user specified diamond size for EPZS (Michael)
|
||||
- Playstation STR playback subsystem, still experimental (Mike and Michael)
|
||||
- ASV2 codec (Michael)
|
||||
- CLJR decoder (Alex)
|
||||
|
||||
.. And lots more new enhancements and fixes.
|
||||
|
||||
version 0.4.6:
|
||||
|
||||
- completely new integer only MPEG audio layer 1/2/3 decoder rewritten
|
||||
from scratch
|
||||
- Recoded DCT and motion vector search with gcc (no longer depends on nasm)
|
||||
- fix quantization bug in AC3 encoder
|
||||
- added PCM codecs and format. Corrected WAV/AVI/ASF PCM issues
|
||||
- added prototype ffplay program
|
||||
- added GOB header parsing on H.263/H.263+ decoder (Juanjo)
|
||||
- bug fix on MCBPC tables of H.263 (Juanjo)
|
||||
- bug fix on DC coefficients of H.263 (Juanjo)
|
||||
- added Advanced Prediction Mode on H.263/H.263+ decoder (Juanjo)
|
||||
- now we can decode H.263 streams found in QuickTime files (Juanjo)
|
||||
- now we can decode H.263 streams found in VIVO v1 files(Juanjo)
|
||||
- preliminary RTP "friendly" mode for H.263/H.263+ coding. (Juanjo)
|
||||
- added GOB header for H.263/H.263+ coding on RTP mode (Juanjo)
|
||||
- now H.263 picture size is returned on the first decoded frame (Juanjo)
|
||||
- added first regression tests
|
||||
- added MPEG-2 TS demuxer
|
||||
- new demux API for libav
|
||||
- more accurate and faster IDCT (Michael)
|
||||
- faster and entropy-controlled motion search (Michael)
|
||||
- two pass video encoding (Michael)
|
||||
- new video rate control (Michael)
|
||||
- added MSMPEG4V1, MSMPEGV2 and WMV1 support (Michael)
|
||||
- great performance improvement of video encoders and decoders (Michael)
|
||||
- new and faster bit readers and vlc parsers (Michael)
|
||||
- high quality encoding mode: tries all macroblock/VLC types (Michael)
|
||||
- added DV video decoder
|
||||
- preliminary RTP/RTSP support in ffserver and libavformat
|
||||
- H.263+ AIC decoding/encoding support (Juanjo)
|
||||
- VCD MPEG-PS mode (Juanjo)
|
||||
- PSNR stuff (Juanjo)
|
||||
- simple stats output (Juanjo)
|
||||
- 16-bit and 15-bit RGB/BGR/GBR support (Bisqwit)
|
||||
|
||||
version 0.4.5:
|
||||
|
||||
- some header fixes (Zdenek Kabelac <kabi at informatics.muni.cz>)
|
||||
- many MMX optimizations (Nick Kurshev <nickols_k at mail.ru>)
|
||||
- added configure system (actually a small shell script)
|
||||
- added MPEG audio layer 1/2/3 decoding using LGPL'ed mpglib by
|
||||
Michael Hipp (temporary solution - waiting for integer only
|
||||
decoder)
|
||||
- fixed VIDIOCSYNC interrupt
|
||||
- added Intel H.263 decoding support ('I263' AVI fourCC)
|
||||
- added Real Video 1.0 decoding (needs further testing)
|
||||
- simplified image formats again. Added PGM format (=grey
|
||||
pgm). Renamed old PGM to PGMYUV.
|
||||
- fixed msmpeg4 slice issues (tell me if you still find problems)
|
||||
- fixed OpenDivX bugs with newer versions (added VOL header decoding)
|
||||
- added support for MPlayer interface
|
||||
- added macroblock skip optimization
|
||||
- added MJPEG decoder
|
||||
- added mmx/mmxext IDCT from libmpeg2
|
||||
- added pgmyuvpipe, ppm, and ppm_pipe formats (original patch by Celer
|
||||
<celer at shell.scrypt.net>)
|
||||
- added pixel format conversion layer (e.g. for MJPEG or PPM)
|
||||
- added deinterlacing option
|
||||
- MPEG-1/2 fixes
|
||||
- MPEG-4 vol header fixes (Jonathan Marsden <snmjbm at pacbell.net>)
|
||||
- ARM optimizations (Lionel Ulmer <lionel.ulmer at free.fr>).
|
||||
- Windows porting of file converter
|
||||
- added MJPEG raw format (input/ouput)
|
||||
- added JPEG image format support (input/output)
|
||||
|
||||
version 0.4.4:
|
||||
|
||||
- fixed some std header definitions (Bjorn Lindgren
|
||||
<bjorn.e.lindgren at telia.com>).
|
||||
- added MPEG demuxer (MPEG-1 and 2 compatible).
|
||||
- added ASF demuxer
|
||||
- added prototype RM demuxer
|
||||
- added AC3 decoding (done with libac3 by Aaron Holtzman)
|
||||
- added decoding codec parameter guessing (.e.g. for MPEG, because the
|
||||
header does not include them)
|
||||
- fixed header generation in MPEG-1, AVI and ASF muxer: wmplayer can now
|
||||
play them (only tested video)
|
||||
- fixed H.263 white bug
|
||||
- fixed phase rounding in img resample filter
|
||||
- add MMX code for polyphase img resample filter
|
||||
- added CPU autodetection
|
||||
- added generic title/author/copyright/comment string handling (ASF and RM
|
||||
use them)
|
||||
- added SWF demux to extract MP3 track (not usable yet because no MP3
|
||||
decoder)
|
||||
- added fractional frame rate support
|
||||
- codecs are no longer searched by read_header() (should fix ffserver
|
||||
segfault)
|
||||
|
||||
version 0.4.3:
|
||||
|
||||
- BGR24 patch (initial patch by Jeroen Vreeken <pe1rxq at amsat.org>)
|
||||
- fixed raw yuv output
|
||||
- added motion rounding support in MPEG-4
|
||||
- fixed motion bug rounding in MSMPEG4
|
||||
- added B-frame handling in video core
|
||||
- added full MPEG-1 decoding support
|
||||
- added partial (frame only) MPEG-2 support
|
||||
- changed the FOURCC code for H.263 to "U263" to be able to see the
|
||||
+AVI/H.263 file with the UB Video H.263+ decoder. MPlayer works with
|
||||
this +codec ;) (JuanJo).
|
||||
- Halfpel motion estimation after MB type selection (JuanJo)
|
||||
- added pgm and .Y.U.V output format
|
||||
- suppressed 'img:' protocol. Simply use: /tmp/test%d.[pgm|Y] as input or
|
||||
output.
|
||||
- added pgmpipe I/O format (original patch from Martin Aumueller
|
||||
<lists at reserv.at>, but changed completely since we use a format
|
||||
instead of a protocol)
|
||||
|
||||
version 0.4.2:
|
||||
|
||||
- added H.263/MPEG-4/MSMPEG4 decoding support. MPEG-4 decoding support
|
||||
(for OpenDivX) is almost complete: 8x8 MVs and rounding are
|
||||
missing. MSMPEG4 support is complete.
|
||||
- added prototype MPEG-1 decoder. Only I- and P-frames handled yet (it
|
||||
can decode ffmpeg MPEGs :-)).
|
||||
- added libavcodec API documentation (see apiexample.c).
|
||||
- fixed image polyphase bug (the bottom of some images could be
|
||||
greenish)
|
||||
- added support for non clipped motion vectors (decoding only)
|
||||
and image sizes non-multiple of 16
|
||||
- added support for AC prediction (decoding only)
|
||||
- added file overwrite confirmation (can be disabled with -y)
|
||||
- added custom size picture to H.263 using H.263+ (Juanjo)
|
||||
|
||||
version 0.4.1:
|
||||
|
||||
- added MSMPEG4 (aka DivX) compatible encoder. Changed default codec
|
||||
of AVI and ASF to DIV3.
|
||||
- added -me option to set motion estimation method
|
||||
(default=log). suppressed redundant -hq option.
|
||||
- added options -acodec and -vcodec to force a given codec (useful for
|
||||
AVI for example)
|
||||
- fixed -an option
|
||||
- improved dct_quantize speed
|
||||
- factorized some motion estimation code
|
||||
|
||||
version 0.4.0:
|
||||
|
||||
- removing grab code from ffserver and moved it to ffmpeg. Added
|
||||
multistream support to ffmpeg.
|
||||
- added timeshifting support for live feeds (option ?date=xxx in the
|
||||
URL)
|
||||
- added high quality image resize code with polyphase filter (need
|
||||
mmx/see optimization). Enable multiple image size support in ffserver.
|
||||
- added multi live feed support in ffserver
|
||||
- suppressed master feature from ffserver (it should be done with an
|
||||
external program which opens the .ffm url and writes it to another
|
||||
ffserver)
|
||||
- added preliminary support for video stream parsing (WAV and AVI half
|
||||
done). Added proper support for audio/video file conversion in
|
||||
ffmpeg.
|
||||
- added preliminary support for video file sending from ffserver
|
||||
- redesigning I/O subsystem: now using URL based input and output
|
||||
(see avio.h)
|
||||
- added WAV format support
|
||||
- added "tty user interface" to ffmpeg to stop grabbing gracefully
|
||||
- added MMX/SSE optimizations to SAD (Sums of Absolutes Differences)
|
||||
(Juan J. Sierralta P. a.k.a. "Juanjo" <juanjo at atmlab.utfsm.cl>)
|
||||
- added MMX DCT from mpeg2_movie 1.5 (Juanjo)
|
||||
- added new motion estimation algorithms, log and phods (Juanjo)
|
||||
- changed directories: libav for format handling, libavcodec for
|
||||
codecs
|
||||
|
||||
version 0.3.4:
|
||||
|
||||
- added stereo in MPEG audio encoder
|
||||
|
||||
version 0.3.3:
|
||||
|
||||
- added 'high quality' mode which use motion vectors. It can be used in
|
||||
real time at low resolution.
|
||||
- fixed rounding problems which caused quality problems at high
|
||||
bitrates and large GOP size
|
||||
|
||||
version 0.3.2: small fixes
|
||||
|
||||
- ASF fixes
|
||||
- put_seek bug fix
|
||||
|
||||
version 0.3.1: added avi/divx support
|
||||
|
||||
- added AVI support
|
||||
- added MPEG-4 codec compatible with OpenDivX. It is based on the H.263 codec
|
||||
- added sound for flash format (not tested)
|
||||
|
||||
version 0.3: initial public release
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
1) Type './configure' to create the configuration. A list of configure
|
||||
options is printed by running 'configure --help'.
|
||||
|
||||
'configure' can be launched from a directory different from the FFmpeg
|
||||
sources to build the objects out of tree. To do this, use an absolute
|
||||
path when launching 'configure', e.g. '/ffmpegdir/ffmpeg/configure'.
|
||||
|
||||
2) Then type 'make' to build FFmpeg. GNU Make 3.81 or later is required.
|
||||
|
||||
3) Type 'make install' to install all binaries and libraries you built.
|
||||
@@ -1,50 +0,0 @@
|
||||
FFmpeg:
|
||||
-------
|
||||
|
||||
Most files in FFmpeg are under the GNU Lesser General Public License version 2.1
|
||||
or later (LGPL v2.1+). Read the file COPYING.LGPLv2.1 for details. Some other
|
||||
files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to
|
||||
FFmpeg.
|
||||
|
||||
Some optional parts of FFmpeg are licensed under the GNU General Public License
|
||||
version 2 or later (GPL v2+). See the file COPYING.GPLv2 for details. None of
|
||||
these parts are used by default, you have to explicitly pass --enable-gpl to
|
||||
configure to activate them. In this case, FFmpeg's license changes to GPL v2+.
|
||||
|
||||
Specifically, the GPL parts of FFmpeg are
|
||||
|
||||
- libpostproc
|
||||
- some x86 optimizations in libswscale
|
||||
- optional x86 optimizations in the files
|
||||
libavcodec/x86/h264_deblock_sse2.asm
|
||||
libavcodec/x86/h264_idct_sse2.asm
|
||||
libavcodec/x86/idct_mmx.c
|
||||
- the X11 grabber in libavdevice/x11grab.c
|
||||
|
||||
There are a handful of files under other licensing terms, namely:
|
||||
|
||||
* The files libavcodec/jfdctfst.c, libavcodec/jfdctint.c, libavcodec/jrevdct.c
|
||||
are taken from libjpeg, see the top of the files for licensing details.
|
||||
|
||||
Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then
|
||||
the configure parameter --enable-version3 will activate this licensing option
|
||||
for you. Read the file COPYING.LGPLv3 or, if you have enabled GPL parts,
|
||||
COPYING.GPLv3 to learn the exact legal terms that apply in this case.
|
||||
|
||||
|
||||
external libraries:
|
||||
-------------------
|
||||
|
||||
Some external libraries, e.g. libx264, are under GPL and can be used in
|
||||
conjunction with FFmpeg. They require --enable-gpl to be passed to configure
|
||||
as well.
|
||||
|
||||
The OpenCORE external libraries are under the Apache License 2.0. That license
|
||||
is incompatible with the LGPL v2.1 and the GPL v2, but not with version 3 of
|
||||
those licenses. So to combine the OpenCORE libraries with FFmpeg, the license
|
||||
version needs to be upgraded by passing --enable-version3 to configure.
|
||||
|
||||
The nonfree external libraries libamrnb, libamrwb and libfaac can be hooked up
|
||||
in FFmpeg. You need to pass --enable-nonfree to configure to enable them. Employ
|
||||
this option with care as FFmpeg then becomes nonfree and unredistributable.
|
||||
Note that libfaac claims to be LGPL, but is not.
|
||||
-334
@@ -1,334 +0,0 @@
|
||||
FFmpeg maintainers
|
||||
==================
|
||||
|
||||
Below is a list of the people maintaining different parts of the
|
||||
FFmpeg code.
|
||||
|
||||
|
||||
Project Leader
|
||||
==============
|
||||
|
||||
final design decisions
|
||||
|
||||
|
||||
Applications
|
||||
============
|
||||
|
||||
ffmpeg:
|
||||
ffmpeg.c Michael Niedermayer
|
||||
|
||||
Video Hooks:
|
||||
vhook
|
||||
vhook/watermark.c Marcus Engene
|
||||
vhook/ppm.c
|
||||
vhook/drawtext.c
|
||||
vhook/fish.c
|
||||
vhook/null.c
|
||||
vhook/imlib2.c
|
||||
|
||||
ffplay:
|
||||
ffplay.c Michael Niedermayer
|
||||
|
||||
ffserver:
|
||||
ffserver.c, ffserver.h Baptiste Coudurier
|
||||
|
||||
Commandline utility code:
|
||||
cmdutils.c, cmdutils.h Michael Niedermayer
|
||||
|
||||
QuickTime faststart:
|
||||
qt-faststart.c Mike Melanson
|
||||
|
||||
|
||||
Miscellaneous Areas
|
||||
===================
|
||||
|
||||
documentation Mike Melanson, Diego Biurrun
|
||||
website Robert Swain
|
||||
build system (configure,Makefiles) Diego Biurrun, Mans Rullgard
|
||||
project server Diego Biurrun, Mans Rullgard
|
||||
mailinglists Michael Niedermayer, Baptiste Coudurier
|
||||
presets Robert Swain
|
||||
release management Diego Biurrun, Reinhard Tartler
|
||||
|
||||
|
||||
libavutil
|
||||
=========
|
||||
|
||||
External Interfaces:
|
||||
libavutil/avutil.h Michael Niedermayer
|
||||
Internal Interfaces:
|
||||
libavutil/common.h Michael Niedermayer
|
||||
|
||||
Other:
|
||||
intfloat* Michael Niedermayer
|
||||
rational.c, rational.h Michael Niedermayer
|
||||
mathematics.c, mathematics.h Michael Niedermayer
|
||||
integer.c, integer.h Michael Niedermayer
|
||||
bswap.h
|
||||
|
||||
|
||||
libavcodec
|
||||
==========
|
||||
|
||||
Generic Parts:
|
||||
External Interfaces:
|
||||
avcodec.h Michael Niedermayer
|
||||
utility code:
|
||||
utils.c Michael Niedermayer
|
||||
mem.c Michael Niedermayer
|
||||
opt.c, opt.h Michael Niedermayer
|
||||
arithmetic expression evaluator:
|
||||
eval.c Michael Niedermayer
|
||||
audio and video frame extraction:
|
||||
parser.c Michael Niedermayer
|
||||
bitstream reading:
|
||||
bitstream.c, bitstream.h Michael Niedermayer
|
||||
CABAC:
|
||||
cabac.h, cabac.c Michael Niedermayer
|
||||
DSP utilities:
|
||||
dsputils.c, dsputils.h Michael Niedermayer
|
||||
entropy coding:
|
||||
rangecoder.c, rangecoder.h Michael Niedermayer
|
||||
lzw.* Michael Niedermayer
|
||||
floating point AAN DCT:
|
||||
faandct.c, faandct.h Michael Niedermayer
|
||||
Golomb coding:
|
||||
golomb.c, golomb.h Michael Niedermayer
|
||||
LPC:
|
||||
lpc.c, lpc.h Justin Ruggles
|
||||
motion estimation:
|
||||
motion* Michael Niedermayer
|
||||
rate control:
|
||||
ratecontrol.c Michael Niedermayer
|
||||
libxvid_rc.c Michael Niedermayer
|
||||
simple IDCT:
|
||||
simple_idct.c, simple_idct.h Michael Niedermayer
|
||||
postprocessing:
|
||||
libpostproc/* Michael Niedermayer
|
||||
vdpau:
|
||||
vdpau* Carl Eugen Hoyos
|
||||
|
||||
Codecs:
|
||||
4xm.c Michael Niedermayer
|
||||
8bps.c Roberto Togni
|
||||
8svx.c Jaikrishnan Menon
|
||||
aasc.c Kostya Shishkov
|
||||
aac.[ch], aactab.[ch], aacdectab.h Robert Swain
|
||||
ac3* Justin Ruggles
|
||||
alacenc.c Jaikrishnan Menon
|
||||
apedec.c Kostya Shishkov
|
||||
asv* Michael Niedermayer
|
||||
atrac3* Benjamin Larsson
|
||||
bmp.c Mans Rullgard, Kostya Shishkov
|
||||
cavs* Stefan Gehrer
|
||||
cinepak.c Roberto Togni
|
||||
cljr Alex Beregszaszi
|
||||
cook.c, cookdata.h Benjamin Larsson
|
||||
cscd.c Reimar Doeffinger
|
||||
dca.c Kostya Shishkov, Benjamin Larsson
|
||||
dnxhd* Baptiste Coudurier
|
||||
dpcm.c Mike Melanson
|
||||
dxa.c Kostya Shishkov
|
||||
dv.c Roman Shaposhnik
|
||||
eacmv*, eaidct*, eat* Peter Ross
|
||||
ffv1.c Michael Niedermayer
|
||||
flacdec.c Alex Beregszaszi, Justin Ruggles
|
||||
flacenc.c Justin Ruggles
|
||||
flashsv* Benjamin Larsson
|
||||
flicvideo.c Mike Melanson
|
||||
g726.c Roman Shaposhnik
|
||||
gifdec.c Baptiste Coudurier
|
||||
h264* Loren Merritt, Michael Niedermayer
|
||||
h261* Michael Niedermayer
|
||||
h263* Michael Niedermayer
|
||||
huffyuv.c Michael Niedermayer
|
||||
idcinvideo.c Mike Melanson
|
||||
imc* Benjamin Larsson
|
||||
indeo2* Kostya Shishkov
|
||||
interplayvideo.c Mike Melanson
|
||||
jpeg_ls.c Kostya Shishkov
|
||||
kmvc.c Kostya Shishkov
|
||||
lcl*.c Roberto Togni
|
||||
libgsm.c Michel Bardiaux
|
||||
libopenjpeg.c Jaikrishnan Menon
|
||||
libx264.c Mans Rullgard, Jason Garrett-Glaser
|
||||
loco.c Kostya Shishkov
|
||||
lzo.h, lzo.c Reimar Doeffinger
|
||||
mdec.c Michael Niedermayer
|
||||
mimic.c Ramiro Polla
|
||||
mjpeg.c Michael Niedermayer
|
||||
mmvideo.c Peter Ross
|
||||
mpc* Kostya Shishkov
|
||||
mpeg12.c, mpeg12data.h Michael Niedermayer
|
||||
mpegvideo.c, mpegvideo.h Michael Niedermayer
|
||||
msmpeg4.c, msmpeg4data.h Michael Niedermayer
|
||||
msrle.c Mike Melanson
|
||||
msvideo1.c Mike Melanson
|
||||
nellymoserdec.c Benjamin Larsson
|
||||
nuv.c Reimar Doeffinger
|
||||
pcx.c Ivo van Poorten
|
||||
ptx.c Ivo van Poorten
|
||||
qcelp* Reynaldo H. Verdejo Pinochet
|
||||
qdm2.c, qdm2data.h Roberto Togni, Benjamin Larsson
|
||||
qdrw.c Kostya Shishkov
|
||||
qpeg.c Kostya Shishkov
|
||||
qtrle.c Mike Melanson
|
||||
ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni
|
||||
resample2.c Michael Niedermayer
|
||||
rl2.c Sascha Sommer
|
||||
rpza.c Roberto Togni
|
||||
rtjpeg.c, rtjpeg.h Reimar Doeffinger
|
||||
rv10.c Michael Niedermayer
|
||||
rv3* Kostya Shishkov
|
||||
rv4* Kostya Shishkov
|
||||
s3tc* Ivo van Poorten
|
||||
smc.c Mike Melanson
|
||||
snow.c Michael Niedermayer, Loren Merritt
|
||||
sonic.c Alex Beregszaszi
|
||||
sunrast.c Ivo van Poorten
|
||||
svq3.c Michael Niedermayer
|
||||
targa.c Kostya Shishkov
|
||||
tiff.c Kostya Shishkov
|
||||
truemotion1* Mike Melanson
|
||||
truemotion2* Kostya Shishkov
|
||||
truespeech.c Kostya Shishkov
|
||||
tscc.c Kostya Shishkov
|
||||
tta.c Alex Beregszaszi
|
||||
txd.c Ivo van Poorten
|
||||
ulti* Kostya Shishkov
|
||||
vb.c Kostya Shishkov
|
||||
vc1* Kostya Shishkov
|
||||
vcr1.c Michael Niedermayer
|
||||
vmnc.c Kostya Shishkov
|
||||
vorbis_enc.c Oded Shimon
|
||||
vorbis_dec.c Denes Balatoni
|
||||
vp3* Mike Melanson
|
||||
vp5 Aurelien Jacobs
|
||||
vp6 Aurelien Jacobs
|
||||
vqavideo.c Mike Melanson
|
||||
wavpack.c Kostya Shishkov
|
||||
wmv2.c Michael Niedermayer
|
||||
wnv1.c Kostya Shishkov
|
||||
xan.c Mike Melanson
|
||||
xl.c Kostya Shishkov
|
||||
xvmc.c Ivan Kalvachev
|
||||
zmbv* Kostya Shishkov
|
||||
|
||||
|
||||
libavdevice
|
||||
===========
|
||||
External Interface:
|
||||
libavdevice/avdevice.h
|
||||
|
||||
|
||||
libdc1394.c Roman Shaposhnik
|
||||
v4l2.c Luca Abeni
|
||||
vfwcap.c Ramiro Polla
|
||||
|
||||
|
||||
libavformat
|
||||
===========
|
||||
|
||||
Generic parts:
|
||||
External Interface:
|
||||
libavformat/avformat.h Michael Niedermayer
|
||||
Utility Code:
|
||||
libavformat/utils.c Michael Niedermayer
|
||||
|
||||
|
||||
Muxers/Demuxers:
|
||||
4xm.c Mike Melanson
|
||||
adtsenc.c Robert Swain
|
||||
aiff.c Baptiste Coudurier
|
||||
ape.c Kostya Shishkov
|
||||
avi* Michael Niedermayer
|
||||
crc.c Michael Niedermayer
|
||||
daud.c Reimar Doeffinger
|
||||
dv.c Roman Shaposhnik
|
||||
dxa.c Kostya Shishkov
|
||||
ffm* Baptiste Coudurier
|
||||
flac* Justin Ruggles
|
||||
flic.c Mike Melanson
|
||||
flvdec.c, flvenc.c Michael Niedermayer
|
||||
gxf.c Reimar Doeffinger
|
||||
gxfenc.c Baptiste Coudurier
|
||||
idcin.c Mike Melanson
|
||||
idroq.c Mike Melanson
|
||||
iff.c Jaikrishnan Menon
|
||||
ipmovie.c Mike Melanson
|
||||
img2.c Michael Niedermayer
|
||||
iss.c Stefan Gehrer
|
||||
libnut.c Oded Shimon
|
||||
lmlm4.c Ivo van Poorten
|
||||
matroska.c Aurelien Jacobs
|
||||
matroskaenc.c David Conrad
|
||||
mm.c Peter Ross
|
||||
mov.c Michael Niedermayer, Baptiste Coudurier
|
||||
movenc.c Michael Niedermayer, Baptiste Coudurier
|
||||
mpc.c Kostya Shishkov
|
||||
mpeg.c Michael Niedermayer
|
||||
mpegenc.c Michael Niedermayer
|
||||
mpegts* Mans Rullgard
|
||||
msnwc_tcp.c Ramiro Polla
|
||||
mtv.c Reynaldo H. Verdejo Pinochet
|
||||
mxf* Baptiste Coudurier
|
||||
nsvdec.c Francois Revol
|
||||
nut.c Michael Niedermayer
|
||||
nuv.c Reimar Doeffinger
|
||||
oggdec.c, oggdec.h Mans Rullgard
|
||||
oggenc.c Baptiste Coudurier
|
||||
oggparsevorbis.c Mans Rullgard
|
||||
oggparseogm.c Mans Rullgard
|
||||
psxstr.c Mike Melanson
|
||||
pva.c Ivo van Poorten
|
||||
r3d.c Baptiste Coudurier
|
||||
raw.c Michael Niedermayer
|
||||
rl2.c Sascha Sommer
|
||||
rm.c Roberto Togni
|
||||
rtp.c, rtpenc.c Luca Abeni
|
||||
rtp_mpv.*, rtp_aac.* Luca Abeni
|
||||
rtsp.c Luca Barbato
|
||||
sdp.c Luca Abeni
|
||||
segafilm.c Mike Melanson
|
||||
siff.c Kostya Shishkov
|
||||
swf.c Baptiste Coudurier
|
||||
tta.c Alex Beregszaszi
|
||||
txd.c Ivo van Poorten
|
||||
voc.c Aurelien Jacobs
|
||||
wav.c Michael Niedermayer
|
||||
wc3movie.c Mike Melanson
|
||||
westwood.c Mike Melanson
|
||||
wv.c Kostya Shishkov
|
||||
|
||||
Protocols:
|
||||
udp.c Luca Abeni
|
||||
|
||||
|
||||
Operating systems / CPU architectures
|
||||
=====================================
|
||||
|
||||
Alpha Mans Rullgard, Falk Hueffner
|
||||
ARM Mans Rullgard
|
||||
BeOS Francois Revol
|
||||
Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier
|
||||
Amiga / PowerPC Colin Ward
|
||||
Linux / PowerPC Luca Barbato
|
||||
Windows MinGW Alex Beregszaszi, Ramiro Polla
|
||||
Windows Cygwin Victor Paesa
|
||||
ADI/Blackfin DSP Marc Hoffman
|
||||
Sparc Roman Shaposhnik
|
||||
x86 Michael Niedermayer
|
||||
|
||||
|
||||
GnuPG Fingerprints of maintainers and others who have svn write access
|
||||
======================================================================
|
||||
|
||||
Benoit Fouet B22A 4F4F 43EF 636B BB66 FCDC 0023 AE1E 2985 49C8
|
||||
Diego Biurrun 8227 1E31 B6D9 4994 7427 E220 9CAE D6CC 4757 FCC5
|
||||
Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
|
||||
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
|
||||
Peter Ross A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B
|
||||
Reimar Döffinger C61D 16E5 9E2C D10C 8958 38A4 0899 A2B9 06D4 D9C7
|
||||
Reinhard Tartler 9300 5DC2 7E87 6C37 ED7B CA9A 9808 3544 9453 48A4
|
||||
Reynaldo H. Verdejo Pinochet 6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A
|
||||
Sascha Sommer 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C
|
||||
@@ -1,360 +0,0 @@
|
||||
include config.mak
|
||||
|
||||
SRC_DIR = $(SRC_PATH_BARE)
|
||||
|
||||
vpath %.texi $(SRC_PATH_BARE)
|
||||
|
||||
PROGS-$(CONFIG_FFMPEG) += ffmpeg
|
||||
PROGS-$(CONFIG_FFPLAY) += ffplay
|
||||
PROGS-$(CONFIG_FFSERVER) += ffserver
|
||||
|
||||
PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
|
||||
PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
|
||||
OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o
|
||||
MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
|
||||
|
||||
BASENAMES = ffmpeg ffplay ffserver
|
||||
ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
|
||||
ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
|
||||
ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
|
||||
|
||||
FFLIBS-$(CONFIG_AVFILTER) += avfilter
|
||||
FFLIBS-$(CONFIG_POSTPROC) += postproc
|
||||
FFLIBS-$(CONFIG_SWSCALE) += swscale
|
||||
|
||||
FFLIBS := avdevice avformat avcodec avutil
|
||||
|
||||
DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
|
||||
|
||||
include common.mak
|
||||
|
||||
FF_LDFLAGS := $(FFLDFLAGS)
|
||||
FF_EXTRALIBS := $(FFEXTRALIBS)
|
||||
FF_DEP_LIBS := $(DEP_LIBS)
|
||||
|
||||
ALL_TARGETS-$(CONFIG_VHOOK) += videohook
|
||||
ALL_TARGETS-$(BUILD_DOC) += documentation
|
||||
|
||||
INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
|
||||
ifneq ($(PROGS),)
|
||||
INSTALL_TARGETS-yes += install-progs install-data
|
||||
INSTALL_TARGETS-$(BUILD_DOC) += install-man
|
||||
endif
|
||||
INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
|
||||
|
||||
all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
|
||||
|
||||
$(PROGS): %$(EXESUF): %_g$(EXESUF)
|
||||
cp -p $< $@
|
||||
$(STRIP) $@
|
||||
|
||||
SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTS
|
||||
|
||||
define RESET
|
||||
$(1) :=
|
||||
$(1)-yes :=
|
||||
endef
|
||||
|
||||
define DOSUBDIR
|
||||
$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
|
||||
SUBDIR := $(1)/
|
||||
include $(1)/Makefile
|
||||
endef
|
||||
|
||||
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
|
||||
|
||||
ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
|
||||
ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
|
||||
|
||||
%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
|
||||
$(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
|
||||
|
||||
output_example$(EXESUF): output_example.o $(FF_DEP_LIBS)
|
||||
$(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
|
||||
|
||||
tools/%$(EXESUF): tools/%.c
|
||||
$(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
|
||||
|
||||
ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
|
||||
|
||||
cmdutils.o cmdutils.d: version.h
|
||||
|
||||
alltools: $(addsuffix $(EXESUF),$(addprefix tools/, cws2fws pktdumper qt-faststart trasher))
|
||||
|
||||
VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
|
||||
|
||||
BASEHOOKS = fish null watermark
|
||||
ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
|
||||
ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
|
||||
|
||||
HOOKS-$(HAVE_FORK) += ppm
|
||||
HOOKS-$(HAVE_IMLIB2) += imlib2
|
||||
HOOKS-$(HAVE_FREETYPE2) += drawtext
|
||||
|
||||
HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
|
||||
|
||||
VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
|
||||
LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
|
||||
|
||||
VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
|
||||
LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
|
||||
|
||||
VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
|
||||
|
||||
vhook/%.o vhook/%.d: CFLAGS:=$(VHOOKCFLAGS)
|
||||
|
||||
# vhooks compile fine without libav*, but need them nonetheless.
|
||||
videohook: $(FF_DEP_LIBS) $(HOOKS)
|
||||
|
||||
$(eval VHOOKSHFLAGS=$(VHOOKSHFLAGS))
|
||||
vhook/%$(SLIBSUF): vhook/%.o
|
||||
$(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
|
||||
|
||||
VHOOK_DEPS = $(HOOKS:$(SLIBSUF)=.d)
|
||||
depend dep: $(VHOOK_DEPS)
|
||||
|
||||
documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
|
||||
ffplay-doc.html general.html hooks.html \
|
||||
$(ALLMANPAGES))
|
||||
|
||||
doc/%.html: doc/%.texi
|
||||
texi2html -monolithic -number $<
|
||||
mv $(@F) $@
|
||||
|
||||
doc/%.pod: doc/%-doc.texi
|
||||
doc/texi2pod.pl $< $@
|
||||
|
||||
doc/%.1: doc/%.pod
|
||||
pod2man --section=1 --center=" " --release=" " $< > $@
|
||||
|
||||
install: $(INSTALL_TARGETS-yes)
|
||||
|
||||
install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
|
||||
install -d "$(BINDIR)"
|
||||
install -c -m 755 $(PROGS) "$(BINDIR)"
|
||||
|
||||
install-data: $(DATA_FILES)
|
||||
install -d "$(DATADIR)"
|
||||
install -m 644 $(DATA_FILES) "$(DATADIR)"
|
||||
|
||||
install-man: $(MANPAGES)
|
||||
install -d "$(MANDIR)/man1"
|
||||
install -m 644 $(MANPAGES) "$(MANDIR)/man1"
|
||||
|
||||
install-vhook: videohook
|
||||
install -d "$(SHLIBDIR)/vhook"
|
||||
install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
|
||||
|
||||
uninstall: uninstall-progs uninstall-data uninstall-man uninstall-vhook
|
||||
|
||||
uninstall-progs:
|
||||
rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
|
||||
|
||||
uninstall-data:
|
||||
rm -rf "$(DATADIR)"
|
||||
|
||||
uninstall-man:
|
||||
rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
|
||||
|
||||
uninstall-vhook:
|
||||
rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
|
||||
-rmdir "$(SHLIBDIR)/vhook/"
|
||||
|
||||
testclean:
|
||||
rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
|
||||
|
||||
clean:: testclean
|
||||
rm -f $(ALLPROGS) $(ALLPROGS_G) output_example$(EXESUF)
|
||||
rm -f doc/*.html doc/*.pod doc/*.1
|
||||
rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
|
||||
rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
|
||||
rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
|
||||
|
||||
distclean::
|
||||
rm -f version.h config.* vhook/*.d
|
||||
|
||||
# regression tests
|
||||
|
||||
check: test checkheaders
|
||||
|
||||
fulltest test: codectest libavtest seektest
|
||||
|
||||
FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
|
||||
FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
|
||||
LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
|
||||
ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
|
||||
SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
|
||||
|
||||
CODEC_TESTS = $(addprefix regtest-, \
|
||||
mpeg \
|
||||
mpeg2 \
|
||||
mpeg2thread \
|
||||
msmpeg4v2 \
|
||||
msmpeg4 \
|
||||
wmv1 \
|
||||
wmv2 \
|
||||
h261 \
|
||||
h263 \
|
||||
h263p \
|
||||
mpeg4 \
|
||||
huffyuv \
|
||||
rc \
|
||||
mpeg4adv \
|
||||
mpeg4thread \
|
||||
error \
|
||||
mpeg4nr \
|
||||
mpeg1b \
|
||||
mjpeg \
|
||||
ljpeg \
|
||||
jpegls \
|
||||
rv10 \
|
||||
rv20 \
|
||||
asv1 \
|
||||
asv2 \
|
||||
flv \
|
||||
ffv1 \
|
||||
snow \
|
||||
snowll \
|
||||
dv \
|
||||
dv50 \
|
||||
svq1 \
|
||||
flashsv \
|
||||
mp2 \
|
||||
ac3 \
|
||||
g726 \
|
||||
adpcm_ima_wav \
|
||||
adpcm_ima_qt \
|
||||
adpcm_ms \
|
||||
adpcm_yam \
|
||||
adpcm_swf \
|
||||
flac \
|
||||
wma \
|
||||
pcm \
|
||||
)
|
||||
|
||||
LAVF_TESTS = $(addprefix regtest-, \
|
||||
avi \
|
||||
asf \
|
||||
rm \
|
||||
mpg \
|
||||
ts \
|
||||
swf \
|
||||
ffm \
|
||||
flv_fmt \
|
||||
mov \
|
||||
dv_fmt \
|
||||
gxf \
|
||||
nut \
|
||||
mkv \
|
||||
pbmpipe \
|
||||
pgmpipe \
|
||||
ppmpipe \
|
||||
gif \
|
||||
yuv4mpeg \
|
||||
pgm \
|
||||
ppm \
|
||||
bmp \
|
||||
tga \
|
||||
tiff \
|
||||
sgi \
|
||||
jpg \
|
||||
wav \
|
||||
alaw \
|
||||
mulaw \
|
||||
au \
|
||||
mmf \
|
||||
aiff \
|
||||
voc \
|
||||
ogg \
|
||||
pixfmt \
|
||||
)
|
||||
|
||||
REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
|
||||
|
||||
CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
|
||||
CODEC_VSYNTH = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
|
||||
|
||||
LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
|
||||
|
||||
LAVF_REG = tests/data/lavf.regression
|
||||
ROTOZOOM_REG = tests/data/rotozoom.regression
|
||||
VSYNTH_REG = tests/data/vsynth.regression
|
||||
|
||||
ifneq ($(CONFIG_SWSCALE),yes)
|
||||
servertest codectest $(CODEC_TESTS) libavtest: swscale-error
|
||||
swscale-error:
|
||||
@echo
|
||||
@echo "This regression test requires --enable-swscale."
|
||||
@echo
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_ZLIB),yes)
|
||||
regtest-flashsv codectest: zlib-error
|
||||
endif
|
||||
zlib-error:
|
||||
@echo
|
||||
@echo "This regression test requires zlib."
|
||||
@echo
|
||||
@exit 1
|
||||
|
||||
codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
|
||||
diff -u -w $(FFMPEG_REFFILE) $(VSYNTH_REG)
|
||||
diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
|
||||
|
||||
libavtest: $(LAVF_REG)
|
||||
diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
|
||||
|
||||
$(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
|
||||
cat $^ > $@
|
||||
|
||||
$(LAVF_REG): $(LAVF_REGFILES)
|
||||
$(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
|
||||
$(VSYNTH_REG): $(CODEC_VSYNTH)
|
||||
|
||||
$(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
|
||||
|
||||
$(LAVF_REGFILES): $(LAVF_TESTS)
|
||||
|
||||
$(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
|
||||
|
||||
regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
|
||||
|
||||
$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(EXESUF)
|
||||
$(SRC_PATH)/tests/regression.sh $@ vsynth tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
|
||||
$(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
|
||||
|
||||
$(LAVF_TESTS):
|
||||
$(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
|
||||
|
||||
seektest: codectest libavtest tests/seek_test$(EXESUF)
|
||||
$(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
|
||||
|
||||
servertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
|
||||
@echo
|
||||
@echo "Unfortunately ffserver is broken and therefore its regression"
|
||||
@echo "test fails randomly. Treat the results accordingly."
|
||||
@echo
|
||||
$(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
|
||||
|
||||
tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
|
||||
mkdir -p tests/vsynth1
|
||||
$(BUILD_ROOT)/$< 'tests/vsynth1/'
|
||||
|
||||
tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
|
||||
mkdir -p tests/vsynth2
|
||||
$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
|
||||
|
||||
tests/asynth1.sw: tests/audiogen$(EXESUF)
|
||||
$(BUILD_ROOT)/$< $@
|
||||
|
||||
tests/%$(EXESUF): tests/%.c
|
||||
$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
|
||||
|
||||
tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
|
||||
$(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
|
||||
|
||||
|
||||
.PHONY: lib videohook documentation *test regtest-* swscale-error zlib-error alltools check
|
||||
|
||||
-include $(VHOOK_DEPS)
|
||||
@@ -1,12 +0,0 @@
|
||||
FFmpeg README
|
||||
-------------
|
||||
|
||||
1) Documentation
|
||||
----------------
|
||||
|
||||
* Read the documentation in the doc/ directory.
|
||||
|
||||
2) Licensing
|
||||
------------
|
||||
|
||||
* See the LICENSE file.
|
||||
@@ -0,0 +1,2 @@
|
||||
# FFmpeg
|
||||
Unofficial mirror of the FFmpeg repository on GitHub. Primary goal is to provide easily reproducible builds that run on Windows.
|
||||
@@ -1,254 +0,0 @@
|
||||
Release Notes
|
||||
=============
|
||||
|
||||
* 0.5 "Bike Shed World Domination" March 3, 2009
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
It has been so long since the last release that this should be considered the
|
||||
first FFmpeg release of recent times. Because of the way things have unfolded to
|
||||
date, the notes for this version cannot be entirely conventional.
|
||||
|
||||
See the Changelog file for a list of significant changes.
|
||||
|
||||
Please note that our policy on bug reports has not changed. We still only accept
|
||||
bug reports against HEAD of the FFmpeg trunk repository. If you are experiencing
|
||||
any issues with any formally released version of FFmpeg, please try a current
|
||||
version of the development code to check if the issue still exists. If it does,
|
||||
make your report against the development code following the usual bug reporting
|
||||
guidelines.
|
||||
|
||||
API notes
|
||||
---------
|
||||
|
||||
In the next release, it is intended to remove a number of deprecated APIs. We
|
||||
decided to put out a release that includes said APIs for the benefit of third
|
||||
party software.
|
||||
|
||||
As such, this release:
|
||||
- provides a sync point for said APIs
|
||||
- increases awareness of API changes
|
||||
- allows the next release to detail how to transition from the old to the new
|
||||
|
||||
The deprecated APIs to be removed are:
|
||||
- imgconvert (to be replaced by libswscale)
|
||||
- vhook (to be replaced by libavfilter)
|
||||
|
||||
If at all possible, do not use the deprecated APIs. All notes on API changes
|
||||
should appear in doc/APIchanges.
|
||||
|
||||
|
||||
|
||||
* 0.5.1 March 2, 2010
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
This point release includes some minor updates to make the 0.5 release series
|
||||
usable for users that need to retain the existing behavior as closely as
|
||||
possible. The changes follow below:
|
||||
|
||||
Security fixes
|
||||
--------------
|
||||
|
||||
Various programming errors in container and codec implementations
|
||||
may lead to denial of service or the execution of arbitrary code
|
||||
if the user is tricked into opening a malformed media file or stream.
|
||||
|
||||
Affected and updated have been the implementations of the following
|
||||
codecs and container formats:
|
||||
|
||||
- the Vorbis audio codec
|
||||
- the FF Video 1 codec
|
||||
- the MPEG audio codec
|
||||
- the H264 video codec
|
||||
- the MLP codec
|
||||
- the HuffYUV codec
|
||||
- the ASF demuxer
|
||||
- the Ogg container implementation
|
||||
- the MOV container implementation
|
||||
|
||||
Symbol Versioning enabled
|
||||
-------------------------
|
||||
|
||||
The backported symbol versioning change is enabled on platforms that support
|
||||
it. This allows users to upgrade from 0.5.1 to the upcoming 0.6 release
|
||||
without having to recompile their applications. Please note that distributors
|
||||
have to recompile applications against 0.5.1 before upgrading to 0.6.
|
||||
|
||||
libx264.c backport
|
||||
------------------
|
||||
|
||||
This release includes a backport to the libx264 wrapper that allows FFmpeg to
|
||||
be compiled against newer versions of libx264 up to API version 85.
|
||||
|
||||
licensing changes
|
||||
-----------------
|
||||
|
||||
Previously both libswscale and our AC-3 decoder had GPLed parts. These have
|
||||
been replaced by fresh LGPL code. x86 optimizations for libswscale remain GPL,
|
||||
but the C code is fully functional. Optimizations for other architectures have
|
||||
been relicensed to LGPL.
|
||||
|
||||
AMR-NB decoding/encoding and AMR-WB decoding is now possible through the free
|
||||
software OpenCORE libraries as an alternative to the non-free libamr libraries.
|
||||
|
||||
We found out that libfaac contains non-free parts and is not LGPL as previously
|
||||
claimed. We have changed configure to reflect this. You now have to pass the
|
||||
--enable-nonfree option if you wish to compile with libfaac support enabled.
|
||||
|
||||
Furthermore the non-free bits in libavcodec/fdctref.c have been rewritten. Note
|
||||
well that they were only used in a test program and never compiled into any
|
||||
FFmpeg library.
|
||||
|
||||
|
||||
|
||||
* 0.5.2 May 25, 2010
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
This is a maintenance-only release that addresses a small number of security
|
||||
and portability issues. Distributors and system integrators are encouraged
|
||||
to update and share their patches against this branch.
|
||||
|
||||
|
||||
|
||||
* 0.5.3 Oct 18, 2010
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
This is (again) another maintenance-only release that addresses a fix
|
||||
for seekable HTTP and an exploitable bug in the FLIC decoder
|
||||
(cf. CVE-2010-3429 for details). Distributors and system integrators are
|
||||
encouraged to update and share their patches against this branch.
|
||||
|
||||
|
||||
|
||||
* 0.5.4 Mar 17, 2011
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
This is the first release that we cut after git migration. It is another
|
||||
maintenance-only release that addresses several security issues that were
|
||||
brought to our attention. In detail, fixes for RV30/40, WMV, Vorbis and
|
||||
VC-1 have been backported from trunk. Distributors and system integrators
|
||||
are encouraged to update and share their patches against this branch.
|
||||
|
||||
|
||||
|
||||
* 0.5.5 Nov 6, 2011
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
This maintenance-only release addresses several security issues that
|
||||
were brought to our attention. In detail, fixes for the MJPEG decoder,
|
||||
the CAVS decoder (CVE-2011-3362, CVE-2011-3973, CVE-2011-3974), and the
|
||||
Matroska decoder (MSVR11-011/CVE-2011-3504) and many others have been
|
||||
corrected. Additional, this release contains fixes for compilation with
|
||||
gcc-4.6. Distributors and system integrators are encouraged to update
|
||||
and share their patches against this branch.
|
||||
|
||||
|
||||
|
||||
* 0.5.6 Nov 21, 2011
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
This maintenance-only release addresses several security issues that
|
||||
were brought to our attention.
|
||||
|
||||
|
||||
|
||||
* 0.5.7 Dec 25, 2011
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
This maintenance-only release addresses several security issues that
|
||||
were brought to our attention. In details, it features fixes for the
|
||||
QDM2 decoder (CVE-2011-4351), DoS in the VP5/VP6 decoders
|
||||
(CVE-2011-4353), and a buffer overflow in the Sierra VMD decoder
|
||||
CVE-2011-4364, and a safety fix in the SVQ1 decoder (CVE-2011-4579).
|
||||
CVE-2011-4352, a bug in the VP3 decoder, is not known to affect this
|
||||
release.
|
||||
|
||||
Distributors and system integrators are encouraged to update and share
|
||||
their patches against this branch.
|
||||
|
||||
|
||||
|
||||
* 0.5.8 Jan 12, 2012
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
This mostly maintenance-only release that addresses a number a number of
|
||||
bugs such as security and compilation issues that have been brought to
|
||||
our attention. Among other (rather minor) fixes, this release features
|
||||
fixes for the VP3 decoder (CVE-2011-3892), vorbis decoder, and matroska
|
||||
demuxer (CVE-2011-3893 and CVE-2011-3895).
|
||||
|
||||
Distributors and system integrators are encouraged
|
||||
to update and share their patches against this branch. For a full list
|
||||
of changes please see the Changelog file.
|
||||
|
||||
|
||||
|
||||
* 0.5.9 May 11, 2012
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
This maintenance-only release that addresses a number a number of
|
||||
security issues that have been brought to our attention. Among other
|
||||
(rather minor) fixes, this release features fixes for the DV decoder
|
||||
(CVE-2011-3929 and CVE-2011-3936), nsvdec (CVE-2011-3940), Atrac3
|
||||
(CVE-2012-0853), mjpegdec (CVE-2011-3947) and the VQA video decoder
|
||||
(CVE-2012-0947).
|
||||
|
||||
Distributors and system integrators are encouraged
|
||||
to update and share their patches against this branch. For a full list
|
||||
of changes please see the Changelog file.
|
||||
|
||||
|
||||
|
||||
* 0.5.10 Jun 09, 2012
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
This mostly maintenance-only release addresses a number of bugs such as
|
||||
security and compilation issues that have been brought to our
|
||||
attention. Among other fixes, this release includes security updates for
|
||||
the DPCM codecs (CVE-2011-3951), H.264 (CVE-2012-0851), ADPCM
|
||||
(CVE-2012-0852), and the KMVC decoder (CVE-2011-3952).
|
||||
|
||||
Distributors and system integrators are encouraged to update and share
|
||||
their patches against this branch. For a full list of changes please see
|
||||
the Changelog file or the Git commit history.
|
||||
|
||||
|
||||
|
||||
* 0.5.11 Feb 17, 2013
|
||||
|
||||
General notes
|
||||
-------------
|
||||
|
||||
This maintenance-only release addresses a number of bugs such as
|
||||
security and compilation issues that have been brought to our
|
||||
attention. Among other fixes, this release includes security updates for
|
||||
the mpeg12 codecs (CVE-2012-2803), H.264, VP5/VP6 (CVE-2012-2783,
|
||||
CVE-2012-2783), shorten (CVE-2012-0858), CAVS (CVE-2012-2777 and
|
||||
CVE-2012-2784), AVS (CVE-2012-2801) and a number of additional safe but
|
||||
important bugs in other decoders. Additionally, reported bugs in the
|
||||
yuv4mpeg (Bug 373) and BMP decoder (Bug 367) have been addressed.
|
||||
|
||||
Distributors and system integrators are encouraged to update and share
|
||||
their patches against this branch. For a full list of changes please
|
||||
see the Changelog file or the Git commit history.
|
||||
-500
@@ -1,500 +0,0 @@
|
||||
/*
|
||||
* Various utilities for command line tools
|
||||
* Copyright (c) 2000-2003 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
||||
/* Include only the enabled headers since some compilers (namely, Sun
|
||||
Studio) will not omit unused inline functions and create undefined
|
||||
references to libraries that are not being built. */
|
||||
|
||||
#include "config.h"
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavfilter/avfilter.h"
|
||||
#include "libavdevice/avdevice.h"
|
||||
#include "libswscale/swscale.h"
|
||||
#include "libpostproc/postprocess.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavcodec/opt.h"
|
||||
#include "cmdutils.h"
|
||||
#include "version.h"
|
||||
#if CONFIG_NETWORK
|
||||
#include "libavformat/network.h"
|
||||
#endif
|
||||
|
||||
#undef exit
|
||||
|
||||
const char **opt_names;
|
||||
static int opt_name_count;
|
||||
AVCodecContext *avctx_opts[CODEC_TYPE_NB];
|
||||
AVFormatContext *avformat_opts;
|
||||
struct SwsContext *sws_opts;
|
||||
|
||||
const int this_year = 2014;
|
||||
|
||||
double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
|
||||
{
|
||||
char *tail;
|
||||
const char *error;
|
||||
double d = strtod(numstr, &tail);
|
||||
if (*tail)
|
||||
error= "Expected number for %s but found: %s\n";
|
||||
else if (d < min || d > max)
|
||||
error= "The value for %s was %s which is not within %f - %f\n";
|
||||
else if(type == OPT_INT64 && (int64_t)d != d)
|
||||
error= "Expected int64 for %s but found %s\n";
|
||||
else
|
||||
return d;
|
||||
fprintf(stderr, error, context, numstr, min, max);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
|
||||
{
|
||||
int64_t us = parse_date(timestr, is_duration);
|
||||
if (us == INT64_MIN) {
|
||||
fprintf(stderr, "Invalid %s specification for %s: %s\n",
|
||||
is_duration ? "duration" : "date", context, timestr);
|
||||
exit(1);
|
||||
}
|
||||
return us;
|
||||
}
|
||||
|
||||
void show_help_options(const OptionDef *options, const char *msg, int mask, int value)
|
||||
{
|
||||
const OptionDef *po;
|
||||
int first;
|
||||
|
||||
first = 1;
|
||||
for(po = options; po->name != NULL; po++) {
|
||||
char buf[64];
|
||||
if ((po->flags & mask) == value) {
|
||||
if (first) {
|
||||
printf("%s", msg);
|
||||
first = 0;
|
||||
}
|
||||
av_strlcpy(buf, po->name, sizeof(buf));
|
||||
if (po->flags & HAS_ARG) {
|
||||
av_strlcat(buf, " ", sizeof(buf));
|
||||
av_strlcat(buf, po->argname, sizeof(buf));
|
||||
}
|
||||
printf("-%-17s %s\n", buf, po->help);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const OptionDef* find_option(const OptionDef *po, const char *name){
|
||||
while (po->name != NULL) {
|
||||
if (!strcmp(name, po->name))
|
||||
break;
|
||||
po++;
|
||||
}
|
||||
return po;
|
||||
}
|
||||
|
||||
void parse_options(int argc, char **argv, const OptionDef *options,
|
||||
void (* parse_arg_function)(const char*))
|
||||
{
|
||||
const char *opt, *arg;
|
||||
int optindex, handleoptions=1;
|
||||
const OptionDef *po;
|
||||
|
||||
/* parse options */
|
||||
optindex = 1;
|
||||
while (optindex < argc) {
|
||||
opt = argv[optindex++];
|
||||
|
||||
if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
|
||||
if (opt[1] == '-' && opt[2] == '\0') {
|
||||
handleoptions = 0;
|
||||
continue;
|
||||
}
|
||||
po= find_option(options, opt + 1);
|
||||
if (!po->name)
|
||||
po= find_option(options, "default");
|
||||
if (!po->name) {
|
||||
unknown_opt:
|
||||
fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt);
|
||||
exit(1);
|
||||
}
|
||||
arg = NULL;
|
||||
if (po->flags & HAS_ARG) {
|
||||
arg = argv[optindex++];
|
||||
if (!arg) {
|
||||
fprintf(stderr, "%s: missing argument for option '%s'\n", argv[0], opt);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (po->flags & OPT_STRING) {
|
||||
char *str;
|
||||
str = av_strdup(arg);
|
||||
*po->u.str_arg = str;
|
||||
} else if (po->flags & OPT_BOOL) {
|
||||
*po->u.int_arg = 1;
|
||||
} else if (po->flags & OPT_INT) {
|
||||
*po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
|
||||
} else if (po->flags & OPT_INT64) {
|
||||
*po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);
|
||||
} else if (po->flags & OPT_FLOAT) {
|
||||
*po->u.float_arg = parse_number_or_die(opt+1, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
|
||||
} else if (po->flags & OPT_FUNC2) {
|
||||
if(po->u.func2_arg(opt+1, arg)<0)
|
||||
goto unknown_opt;
|
||||
} else {
|
||||
po->u.func_arg(arg);
|
||||
}
|
||||
if(po->flags & OPT_EXIT)
|
||||
exit(0);
|
||||
} else {
|
||||
if (parse_arg_function)
|
||||
parse_arg_function(opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int opt_default(const char *opt, const char *arg){
|
||||
int type;
|
||||
int ret= 0;
|
||||
const AVOption *o= NULL;
|
||||
int opt_types[]={AV_OPT_FLAG_VIDEO_PARAM, AV_OPT_FLAG_AUDIO_PARAM, 0, AV_OPT_FLAG_SUBTITLE_PARAM, 0};
|
||||
|
||||
for(type=0; type<CODEC_TYPE_NB && ret>= 0; type++){
|
||||
const AVOption *o2 = av_find_opt(avctx_opts[0], opt, NULL, opt_types[type], opt_types[type]);
|
||||
if(o2)
|
||||
ret = av_set_string3(avctx_opts[type], opt, arg, 1, &o);
|
||||
}
|
||||
if(!o)
|
||||
ret = av_set_string3(avformat_opts, opt, arg, 1, &o);
|
||||
if(!o)
|
||||
ret = av_set_string3(sws_opts, opt, arg, 1, &o);
|
||||
if(!o){
|
||||
if(opt[0] == 'a')
|
||||
ret = av_set_string3(avctx_opts[CODEC_TYPE_AUDIO], opt+1, arg, 1, &o);
|
||||
else if(opt[0] == 'v')
|
||||
ret = av_set_string3(avctx_opts[CODEC_TYPE_VIDEO], opt+1, arg, 1, &o);
|
||||
else if(opt[0] == 's')
|
||||
ret = av_set_string3(avctx_opts[CODEC_TYPE_SUBTITLE], opt+1, arg, 1, &o);
|
||||
}
|
||||
if (o && ret < 0) {
|
||||
fprintf(stderr, "Invalid value '%s' for option '%s'\n", arg, opt);
|
||||
exit(1);
|
||||
}
|
||||
if(!o)
|
||||
return -1;
|
||||
|
||||
// av_log(NULL, AV_LOG_ERROR, "%s:%s: %f 0x%0X\n", opt, arg, av_get_double(avctx_opts, opt, NULL), (int)av_get_int(avctx_opts, opt, NULL));
|
||||
|
||||
//FIXME we should always use avctx_opts, ... for storing options so there will not be any need to keep track of what i set over this
|
||||
opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1));
|
||||
opt_names[opt_name_count++]= o->name;
|
||||
|
||||
if(avctx_opts[0]->debug || avformat_opts->debug)
|
||||
av_log_set_level(AV_LOG_DEBUG);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void set_context_opts(void *ctx, void *opts_ctx, int flags)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<opt_name_count; i++){
|
||||
char buf[256];
|
||||
const AVOption *opt;
|
||||
const char *str= av_get_string(opts_ctx, opt_names[i], &opt, buf, sizeof(buf));
|
||||
/* if an option with name opt_names[i] is present in opts_ctx then str is non-NULL */
|
||||
if(str && ((opt->flags & flags) == flags))
|
||||
av_set_string3(ctx, opt_names[i], str, 1, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void print_error(const char *filename, int err)
|
||||
{
|
||||
switch(err) {
|
||||
case AVERROR_NUMEXPECTED:
|
||||
fprintf(stderr, "%s: Incorrect image filename syntax.\n"
|
||||
"Use '%%d' to specify the image number:\n"
|
||||
" for img1.jpg, img2.jpg, ..., use 'img%%d.jpg';\n"
|
||||
" for img001.jpg, img002.jpg, ..., use 'img%%03d.jpg'.\n",
|
||||
filename);
|
||||
break;
|
||||
case AVERROR_INVALIDDATA:
|
||||
fprintf(stderr, "%s: Error while parsing header\n", filename);
|
||||
break;
|
||||
case AVERROR_NOFMT:
|
||||
fprintf(stderr, "%s: Unknown format\n", filename);
|
||||
break;
|
||||
case AVERROR(EIO):
|
||||
fprintf(stderr, "%s: I/O error occurred\n"
|
||||
"Usually that means that input file is truncated and/or corrupted.\n",
|
||||
filename);
|
||||
break;
|
||||
case AVERROR(ENOMEM):
|
||||
fprintf(stderr, "%s: memory allocation error occurred\n", filename);
|
||||
break;
|
||||
case AVERROR(ENOENT):
|
||||
fprintf(stderr, "%s: no such file or directory\n", filename);
|
||||
break;
|
||||
#if CONFIG_NETWORK
|
||||
case AVERROR(FF_NETERROR(EPROTONOSUPPORT)):
|
||||
fprintf(stderr, "%s: Unsupported network protocol\n", filename);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
fprintf(stderr, "%s: Error while opening file\n", filename);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#define PRINT_LIB_VERSION(outstream,libname,LIBNAME,indent) \
|
||||
version= libname##_version(); \
|
||||
fprintf(outstream, "%slib%-10s %2d.%2d.%2d / %2d.%2d.%2d\n", indent? " " : "", #libname, \
|
||||
LIB##LIBNAME##_VERSION_MAJOR, LIB##LIBNAME##_VERSION_MINOR, LIB##LIBNAME##_VERSION_MICRO, \
|
||||
version >> 16, version >> 8 & 0xff, version & 0xff);
|
||||
|
||||
static void print_all_lib_versions(FILE* outstream, int indent)
|
||||
{
|
||||
unsigned int version;
|
||||
PRINT_LIB_VERSION(outstream, avutil, AVUTIL, indent);
|
||||
PRINT_LIB_VERSION(outstream, avcodec, AVCODEC, indent);
|
||||
PRINT_LIB_VERSION(outstream, avformat, AVFORMAT, indent);
|
||||
PRINT_LIB_VERSION(outstream, avdevice, AVDEVICE, indent);
|
||||
#if CONFIG_AVFILTER
|
||||
PRINT_LIB_VERSION(outstream, avfilter, AVFILTER, indent);
|
||||
#endif
|
||||
#if CONFIG_SWSCALE
|
||||
PRINT_LIB_VERSION(outstream, swscale, SWSCALE, indent);
|
||||
#endif
|
||||
#if CONFIG_POSTPROC
|
||||
PRINT_LIB_VERSION(outstream, postproc, POSTPROC, indent);
|
||||
#endif
|
||||
}
|
||||
|
||||
void show_banner(void)
|
||||
{
|
||||
fprintf(stderr, "%s version " FFMPEG_VERSION ", Copyright (c) %d-%d Fabrice Bellard, et al.\n",
|
||||
program_name, program_birth_year, this_year);
|
||||
fprintf(stderr, " configuration: " FFMPEG_CONFIGURATION "\n");
|
||||
print_all_lib_versions(stderr, 1);
|
||||
fprintf(stderr, " built on " __DATE__ " " __TIME__);
|
||||
#ifdef __GNUC__
|
||||
fprintf(stderr, ", gcc: " __VERSION__ "\n");
|
||||
#else
|
||||
fprintf(stderr, ", using a non-gcc compiler\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void show_version(void) {
|
||||
printf("%s " FFMPEG_VERSION "\n", program_name);
|
||||
print_all_lib_versions(stdout, 0);
|
||||
}
|
||||
|
||||
void show_license(void)
|
||||
{
|
||||
printf(
|
||||
#if CONFIG_NONFREE
|
||||
"This version of %s has nonfree parts compiled in.\n"
|
||||
"Therefore it is not legally redistributable.\n",
|
||||
program_name
|
||||
#elif CONFIG_GPLV3
|
||||
"%s is free software; you can redistribute it and/or modify\n"
|
||||
"it under the terms of the GNU General Public License as published by\n"
|
||||
"the Free Software Foundation; either version 3 of the License, or\n"
|
||||
"(at your option) any later version.\n"
|
||||
"\n"
|
||||
"%s is distributed in the hope that it will be useful,\n"
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
||||
"GNU General Public License for more details.\n"
|
||||
"\n"
|
||||
"You should have received a copy of the GNU General Public License\n"
|
||||
"along with %s. If not, see <http://www.gnu.org/licenses/>.\n",
|
||||
program_name, program_name, program_name
|
||||
#elif CONFIG_GPL
|
||||
"%s is free software; you can redistribute it and/or modify\n"
|
||||
"it under the terms of the GNU General Public License as published by\n"
|
||||
"the Free Software Foundation; either version 2 of the License, or\n"
|
||||
"(at your option) any later version.\n"
|
||||
"\n"
|
||||
"%s is distributed in the hope that it will be useful,\n"
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
||||
"GNU General Public License for more details.\n"
|
||||
"\n"
|
||||
"You should have received a copy of the GNU General Public License\n"
|
||||
"along with %s; if not, write to the Free Software\n"
|
||||
"Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
|
||||
program_name, program_name, program_name
|
||||
#elif CONFIG_LGPLV3
|
||||
"%s is free software; you can redistribute it and/or modify\n"
|
||||
"it under the terms of the GNU Lesser General Public License as published by\n"
|
||||
"the Free Software Foundation; either version 3 of the License, or\n"
|
||||
"(at your option) any later version.\n"
|
||||
"\n"
|
||||
"%s is distributed in the hope that it will be useful,\n"
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
||||
"GNU Lesser General Public License for more details.\n"
|
||||
"\n"
|
||||
"You should have received a copy of the GNU Lesser General Public License\n"
|
||||
"along with %s. If not, see <http://www.gnu.org/licenses/>.\n",
|
||||
program_name, program_name, program_name
|
||||
#else
|
||||
"%s is free software; you can redistribute it and/or\n"
|
||||
"modify it under the terms of the GNU Lesser General Public\n"
|
||||
"License as published by the Free Software Foundation; either\n"
|
||||
"version 2.1 of the License, or (at your option) any later version.\n"
|
||||
"\n"
|
||||
"%s is distributed in the hope that it will be useful,\n"
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
|
||||
"Lesser General Public License for more details.\n"
|
||||
"\n"
|
||||
"You should have received a copy of the GNU Lesser General Public\n"
|
||||
"License along with %s; if not, write to the Free Software\n"
|
||||
"Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
|
||||
program_name, program_name, program_name
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
void show_formats(void)
|
||||
{
|
||||
AVInputFormat *ifmt=NULL;
|
||||
AVOutputFormat *ofmt=NULL;
|
||||
URLProtocol *up=NULL;
|
||||
AVCodec *p=NULL, *p2;
|
||||
AVBitStreamFilter *bsf=NULL;
|
||||
const char *last_name;
|
||||
|
||||
printf("File formats:\n");
|
||||
last_name= "000";
|
||||
for(;;){
|
||||
int decode=0;
|
||||
int encode=0;
|
||||
const char *name=NULL;
|
||||
const char *long_name=NULL;
|
||||
|
||||
while((ofmt= av_oformat_next(ofmt))) {
|
||||
if((name == NULL || strcmp(ofmt->name, name)<0) &&
|
||||
strcmp(ofmt->name, last_name)>0){
|
||||
name= ofmt->name;
|
||||
long_name= ofmt->long_name;
|
||||
encode=1;
|
||||
}
|
||||
}
|
||||
while((ifmt= av_iformat_next(ifmt))) {
|
||||
if((name == NULL || strcmp(ifmt->name, name)<0) &&
|
||||
strcmp(ifmt->name, last_name)>0){
|
||||
name= ifmt->name;
|
||||
long_name= ifmt->long_name;
|
||||
encode=0;
|
||||
}
|
||||
if(name && strcmp(ifmt->name, name)==0)
|
||||
decode=1;
|
||||
}
|
||||
if(name==NULL)
|
||||
break;
|
||||
last_name= name;
|
||||
|
||||
printf(
|
||||
" %s%s %-15s %s\n",
|
||||
decode ? "D":" ",
|
||||
encode ? "E":" ",
|
||||
name,
|
||||
long_name ? long_name:" ");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("Codecs:\n");
|
||||
last_name= "000";
|
||||
for(;;){
|
||||
int decode=0;
|
||||
int encode=0;
|
||||
int cap=0;
|
||||
const char *type_str;
|
||||
|
||||
p2=NULL;
|
||||
while((p= av_codec_next(p))) {
|
||||
if((p2==NULL || strcmp(p->name, p2->name)<0) &&
|
||||
strcmp(p->name, last_name)>0){
|
||||
p2= p;
|
||||
decode= encode= cap=0;
|
||||
}
|
||||
if(p2 && strcmp(p->name, p2->name)==0){
|
||||
if(p->decode) decode=1;
|
||||
if(p->encode) encode=1;
|
||||
cap |= p->capabilities;
|
||||
}
|
||||
}
|
||||
if(p2==NULL)
|
||||
break;
|
||||
last_name= p2->name;
|
||||
|
||||
switch(p2->type) {
|
||||
case CODEC_TYPE_VIDEO:
|
||||
type_str = "V";
|
||||
break;
|
||||
case CODEC_TYPE_AUDIO:
|
||||
type_str = "A";
|
||||
break;
|
||||
case CODEC_TYPE_SUBTITLE:
|
||||
type_str = "S";
|
||||
break;
|
||||
default:
|
||||
type_str = "?";
|
||||
break;
|
||||
}
|
||||
printf(
|
||||
" %s%s%s%s%s%s %-15s %s",
|
||||
decode ? "D": (/*p2->decoder ? "d":*/" "),
|
||||
encode ? "E":" ",
|
||||
type_str,
|
||||
cap & CODEC_CAP_DRAW_HORIZ_BAND ? "S":" ",
|
||||
cap & CODEC_CAP_DR1 ? "D":" ",
|
||||
cap & CODEC_CAP_TRUNCATED ? "T":" ",
|
||||
p2->name,
|
||||
p2->long_name ? p2->long_name : "");
|
||||
/* if(p2->decoder && decode==0)
|
||||
printf(" use %s for decoding", p2->decoder->name);*/
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("Bitstream filters:\n");
|
||||
while((bsf = av_bitstream_filter_next(bsf)))
|
||||
printf(" %s", bsf->name);
|
||||
printf("\n");
|
||||
|
||||
printf("Supported file protocols:\n");
|
||||
while((up = av_protocol_next(up)))
|
||||
printf(" %s:", up->name);
|
||||
printf("\n");
|
||||
|
||||
printf("Frame size, frame rate abbreviations:\n ntsc pal qntsc qpal sntsc spal film ntsc-film sqcif qcif cif 4cif\n");
|
||||
printf("\n");
|
||||
printf(
|
||||
"Note, the names of encoders and decoders do not always match, so there are\n"
|
||||
"several cases where the above table shows encoder only or decoder only entries\n"
|
||||
"even though both encoding and decoding are supported. For example, the h263\n"
|
||||
"decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
|
||||
"worse.\n");
|
||||
}
|
||||
-155
@@ -1,155 +0,0 @@
|
||||
/*
|
||||
* Various utilities for command line tools
|
||||
* copyright (c) 2003 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef FFMPEG_CMDUTILS_H
|
||||
#define FFMPEG_CMDUTILS_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libswscale/swscale.h"
|
||||
|
||||
/**
|
||||
* program name, defined by the program for show_version().
|
||||
*/
|
||||
extern const char program_name[];
|
||||
|
||||
/**
|
||||
* program birth year, defined by the program for show_banner()
|
||||
*/
|
||||
extern const int program_birth_year;
|
||||
|
||||
extern const int this_year;
|
||||
|
||||
extern const char **opt_names;
|
||||
extern AVCodecContext *avctx_opts[CODEC_TYPE_NB];
|
||||
extern AVFormatContext *avformat_opts;
|
||||
extern struct SwsContext *sws_opts;
|
||||
|
||||
/**
|
||||
* Fallback for options that are not explicitly handled, these will be
|
||||
* parsed through AVOptions.
|
||||
*/
|
||||
int opt_default(const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Parses a string and returns its corresponding value as a double.
|
||||
* Exits from the application if the string cannot be correctly
|
||||
* parsed or the corresponding value is invalid.
|
||||
*
|
||||
* @param context the context of the value to be set (e.g. the
|
||||
* corresponding commandline option name)
|
||||
* @param numstr the string to be parsed
|
||||
* @param type the type (OPT_INT64 or OPT_FLOAT) as which the
|
||||
* string should be parsed
|
||||
* @param min the minimum valid accepted value
|
||||
* @param max the maximum valid accepted value
|
||||
*/
|
||||
double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max);
|
||||
|
||||
/**
|
||||
* Parses a string specifying a time and returns its corresponding
|
||||
* value as a number of microseconds. Exits from the application if
|
||||
* the string cannot be correctly parsed.
|
||||
*
|
||||
* @param context the context of the value to be set (e.g. the
|
||||
* corresponding commandline option name)
|
||||
* @param timestr the string to be parsed
|
||||
* @param is_duration a flag which tells how to interpret \p timestr, if
|
||||
* not zero \p timestr is interpreted as a duration, otherwise as a
|
||||
* date
|
||||
*
|
||||
* @see parse_date()
|
||||
*/
|
||||
int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration);
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int flags;
|
||||
#define HAS_ARG 0x0001
|
||||
#define OPT_BOOL 0x0002
|
||||
#define OPT_EXPERT 0x0004
|
||||
#define OPT_STRING 0x0008
|
||||
#define OPT_VIDEO 0x0010
|
||||
#define OPT_AUDIO 0x0020
|
||||
#define OPT_GRAB 0x0040
|
||||
#define OPT_INT 0x0080
|
||||
#define OPT_FLOAT 0x0100
|
||||
#define OPT_SUBTITLE 0x0200
|
||||
#define OPT_FUNC2 0x0400
|
||||
#define OPT_INT64 0x0800
|
||||
#define OPT_EXIT 0x1000
|
||||
union {
|
||||
void (*func_arg)(const char *); //FIXME passing error code as int return would be nicer then exit() in the func
|
||||
int *int_arg;
|
||||
char **str_arg;
|
||||
float *float_arg;
|
||||
int (*func2_arg)(const char *, const char *);
|
||||
int64_t *int64_arg;
|
||||
} u;
|
||||
const char *help;
|
||||
const char *argname;
|
||||
} OptionDef;
|
||||
|
||||
void show_help_options(const OptionDef *options, const char *msg, int mask, int value);
|
||||
|
||||
/**
|
||||
* Parses the command line arguments.
|
||||
* @param options Array with the definitions required to interpret every
|
||||
* option of the form: -<option_name> [<argument>]
|
||||
* @param parse_arg_function Name of the function called to process every
|
||||
* argument without a leading option name flag. NULL if such arguments do
|
||||
* not have to be processed.
|
||||
*/
|
||||
void parse_options(int argc, char **argv, const OptionDef *options,
|
||||
void (* parse_arg_function)(const char*));
|
||||
|
||||
void set_context_opts(void *ctx, void *opts_ctx, int flags);
|
||||
|
||||
void print_error(const char *filename, int err);
|
||||
|
||||
/**
|
||||
* Prints the program banner to stderr. The banner contents depend on the
|
||||
* current version of the repository and of the libav* libraries used by
|
||||
* the program.
|
||||
*/
|
||||
void show_banner(void);
|
||||
|
||||
/**
|
||||
* Prints the version of the program to stdout. The version message
|
||||
* depends on the current versions of the repository and of the libav*
|
||||
* libraries.
|
||||
*/
|
||||
void show_version(void);
|
||||
|
||||
/**
|
||||
* Prints the license of the program to stdout. The license depends on
|
||||
* the license of the libraries compiled into the program.
|
||||
*/
|
||||
void show_license(void);
|
||||
|
||||
/**
|
||||
* Prints a listing containing all the formats supported by the
|
||||
* program.
|
||||
*/
|
||||
void show_formats(void);
|
||||
|
||||
#endif /* FFMPEG_CMDUTILS_H */
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
#
|
||||
# common bits used by all libraries
|
||||
#
|
||||
|
||||
all: # make "all" default target
|
||||
|
||||
ifndef SUBDIR
|
||||
vpath %.c $(SRC_DIR)
|
||||
vpath %.h $(SRC_DIR)
|
||||
vpath %.S $(SRC_DIR)
|
||||
vpath %.asm $(SRC_DIR)
|
||||
vpath %.v $(SRC_DIR)
|
||||
|
||||
ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
|
||||
BUILD_ROOT_REL = .
|
||||
else
|
||||
BUILD_ROOT_REL = ..
|
||||
endif
|
||||
|
||||
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
|
||||
|
||||
CFLAGS := -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
|
||||
-I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(OPTFLAGS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
|
||||
|
||||
%.o: %.S
|
||||
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
|
||||
|
||||
%.ho: %.h
|
||||
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
|
||||
|
||||
%.d: %.c
|
||||
$(DEPEND_CMD) > $@
|
||||
|
||||
%.d: %.S
|
||||
$(DEPEND_CMD) > $@
|
||||
|
||||
%.d: %.cpp
|
||||
$(DEPEND_CMD) > $@
|
||||
|
||||
%.o: %.d
|
||||
|
||||
%$(EXESUF): %.c
|
||||
|
||||
%.ver: %.v
|
||||
sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
|
||||
|
||||
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
|
||||
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
|
||||
$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
|
||||
endif
|
||||
|
||||
$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh
|
||||
$< $(SRC_PATH) $@ $(EXTRA_VERSION)
|
||||
|
||||
install: install-libs install-headers
|
||||
|
||||
uninstall: uninstall-libs uninstall-headers
|
||||
|
||||
.PHONY: all depend dep clean distclean install* uninstall* tests
|
||||
endif
|
||||
|
||||
CFLAGS += $(CFLAGS-yes)
|
||||
OBJS += $(OBJS-yes)
|
||||
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
|
||||
TESTS += $(TESTS-yes)
|
||||
|
||||
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
|
||||
FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
|
||||
|
||||
OBJS := $(addprefix $(SUBDIR),$(OBJS))
|
||||
TESTS := $(addprefix $(SUBDIR),$(TESTS))
|
||||
|
||||
DEP_LIBS:=$(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
|
||||
|
||||
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
|
||||
checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
|
||||
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
depend dep: $(DEPS)
|
||||
|
||||
CLEANSUFFIXES = *.o *~ *.ho *.ver
|
||||
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
|
||||
DISTCLEANSUFFIXES = *.d *.pc
|
||||
|
||||
define RULES
|
||||
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
|
||||
$(CC) $(FFLDFLAGS) -o $$@ $$^ $(SUBDIR)$(LIBNAME) $(FFEXTRALIBS)
|
||||
|
||||
$(SUBDIR)%-test.o: $(SUBDIR)%.c
|
||||
$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
|
||||
|
||||
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
|
||||
$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
|
||||
|
||||
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
|
||||
$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
|
||||
|
||||
$(SUBDIR)x86/%.d: $(SUBDIR)x86/%.asm
|
||||
$(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$(@:%.d=%.o) $$< > $$@
|
||||
|
||||
clean::
|
||||
rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
|
||||
$(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
|
||||
|
||||
distclean:: clean
|
||||
rm -f $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
|
||||
$(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
|
||||
endef
|
||||
|
||||
$(eval $(RULES))
|
||||
|
||||
tests: $(TESTS)
|
||||
|
||||
-include $(DEPS)
|
||||
@@ -1,25 +0,0 @@
|
||||
20090601 - r19025 - lavc 52.30.0 - av_lockmgr_register()
|
||||
av_lockmgr_register() can be used to register a callback function
|
||||
that lavc (and in the future, libraries that depend on lavc) can use
|
||||
to implement mutexes. The application should provide a callback function
|
||||
the implements the AV_LOCK_* operations described in avcodec.h.
|
||||
When the lock manager is registered FFmpeg is guaranteed to behave
|
||||
correct also in a multi-threaded application.
|
||||
|
||||
20090301 - r17682 - lavf 52.31.0 - Generic metadata API
|
||||
This version introduce a new metadata API (see av_metadata_get() and friends).
|
||||
The old API is now deprecated and shouldn't be used anymore. This especially
|
||||
include the following structure fields:
|
||||
- AVFormatContext.title
|
||||
- AVFormatContext.author
|
||||
- AVFormatContext.copyright
|
||||
- AVFormatContext.comment
|
||||
- AVFormatContext.album
|
||||
- AVFormatContext.year
|
||||
- AVFormatContext.track
|
||||
- AVFormatContext.genre
|
||||
- AVStream.language
|
||||
- AVStream.filename
|
||||
- AVProgram.provider_name
|
||||
- AVProgram.name
|
||||
- AVChapter.title
|
||||
@@ -1,90 +0,0 @@
|
||||
ffmpeg TODO list:
|
||||
----------------
|
||||
|
||||
Fabrice's TODO list: (unordered)
|
||||
-------------------
|
||||
Short term:
|
||||
|
||||
- use AVFMTCTX_DISCARD_PKT in ffplay so that DV has a chance to work
|
||||
- add RTSP regression test (both client and server)
|
||||
- make ffserver allocate AVFormatContext
|
||||
- clean up (incompatible change, for 0.5.0):
|
||||
* AVStream -> AVComponent
|
||||
* AVFormatContext -> AVInputStream/AVOutputStream
|
||||
* suppress rate_emu from AVCodecContext
|
||||
- add new float/integer audio filterting and conversion : suppress
|
||||
CODEC_ID_PCM_xxc and use CODEC_ID_RAWAUDIO.
|
||||
- fix telecine and frame rate conversion
|
||||
|
||||
Long term (ask me if you want to help):
|
||||
|
||||
- commit new imgconvert API and new PIX_FMT_xxx alpha formats
|
||||
- commit new LGPL'ed float and integer-only AC3 decoder
|
||||
- add WMA integer-only decoder
|
||||
- add new MPEG4-AAC audio decoder (both integer-only and float version)
|
||||
|
||||
Michael's TODO list: (unordered) (if anyone wanna help with sth, just ask)
|
||||
-------------------
|
||||
- optimize H264 CABAC
|
||||
- more optimizations
|
||||
- simper rate control
|
||||
|
||||
Francois' TODO list: (unordered, without any timeframe)
|
||||
-------------------
|
||||
- test MACE decoder against the openquicktime one as suggested by A'rpi
|
||||
- BeOS audio input grabbing backend
|
||||
- BeOS video input grabbing backend
|
||||
- publish my BeOS libposix on BeBits so I can officially support ffserver :)
|
||||
- check the whole code for thread-safety (global and init stuff)
|
||||
|
||||
Philip'a TODO list: (alphabetically ordered) (please help)
|
||||
------------------
|
||||
- Add a multi-ffm filetype so that feeds can be recorded into multiple files rather
|
||||
than one big file.
|
||||
- Authenticated users support -- where the authentication is in the URL
|
||||
- Change ASF files so that the embedded timestamp in the frames is right rather
|
||||
than being an offset from the start of the stream
|
||||
- Make ffm files more resilient to changes in the codec structures so that you
|
||||
can play old ffm files.
|
||||
|
||||
Baptiste's TODO list:
|
||||
-----------------
|
||||
- mov edit list support (AVEditList)
|
||||
- YUV 10 bit per component support "2vuy"
|
||||
- mxf muxer
|
||||
- mpeg2 non linear quantizer
|
||||
|
||||
unassigned TODO: (unordered)
|
||||
---------------
|
||||
- use AVFrame for audio codecs too
|
||||
- rework aviobuf.c buffering strategy and fix url_fskip
|
||||
- generate optimal huffman tables for mjpeg encoding
|
||||
- fix ffserver regression tests
|
||||
- support xvids motion estimation
|
||||
- support x264s motion estimation
|
||||
- support x264s rate control
|
||||
- SNOW: non translational motion compensation
|
||||
- SNOW: more optimal quantization
|
||||
- SNOW: 4x4 block support
|
||||
- SNOW: 1/8 pel motion compensation support
|
||||
- SNOW: iterative motion estimation based on subsampled images
|
||||
- SNOW: try B frames and MCTF and see how their PSNR/bitrate/complexity behaves
|
||||
- SNOW: try to use the wavelet transformed MC-ed reference frame as context for the entropy coder
|
||||
- SNOW: think about/analyize how to make snow use multiple cpus/threads
|
||||
- SNOW: finish spec
|
||||
- FLAC: lossy encoding (viterbi and naive scalar quantization)
|
||||
- libavfilter
|
||||
- JPEG2000 decoder & encoder
|
||||
- MPEG4 GMC encoding support
|
||||
- macroblock based pixel format (better cache locality, somewhat complex, one paper claimed it faster for high res)
|
||||
- regression tests for codecs which do not have an encoder (I+P-frame bitstream in svn)
|
||||
- add support for using mplayers video filters to ffmpeg
|
||||
- H264 encoder
|
||||
- per MB ratecontrol (so VCD and such do work better)
|
||||
- write a script which iteratively changes all functions between always_inline and noinline and benchmarks the result to find the best set of inlined functions
|
||||
- convert all the non SIMD asm into small asm vs. C testcases and submit them to the gcc devels so they can improve gcc
|
||||
- generic audio mixing API
|
||||
- extract PES packetizer from PS muxer and use it for new TS muxer
|
||||
- implement automatic AVBistreamFilter activation
|
||||
- make cabac encoder use bytestream (see http://trac.videolan.org/x264/changeset/?format=diff&new=651)
|
||||
- merge imdct and windowing, the current code does considerable amounts of redundant work
|
||||
@@ -1,37 +0,0 @@
|
||||
AVUtil
|
||||
======
|
||||
libavutil is a small lightweight library of generally useful functions.
|
||||
It is not a library for code needed by both libavcodec and libavformat.
|
||||
|
||||
|
||||
Overview:
|
||||
=========
|
||||
adler32.c adler32 checksum
|
||||
aes.c AES encryption and decryption
|
||||
fifo.c resizeable first in first out buffer
|
||||
intfloat_readwrite.c portable reading and writing of floating point values
|
||||
log.c "printf" with context and level
|
||||
md5.c MD5 Message-Digest Algorithm
|
||||
rational.c code to perform exact calculations with rational numbers
|
||||
tree.c generic AVL tree
|
||||
crc.c generic CRC checksumming code
|
||||
integer.c 128bit integer math
|
||||
lls.c
|
||||
mathematics.c greatest common divisor, integer sqrt, integer log2, ...
|
||||
mem.c memory allocation routines with guaranteed alignment
|
||||
softfloat.c
|
||||
|
||||
Headers:
|
||||
bswap.h big/little/native-endian conversion code
|
||||
x86_cpu.h a few useful macros for unifying x86-64 and x86-32 code
|
||||
avutil.h
|
||||
common.h
|
||||
intreadwrite.h reading and writing of unaligned big/little/native-endian integers
|
||||
|
||||
|
||||
Goals:
|
||||
======
|
||||
* Modular (few interdependencies and the possibility of disabling individual parts during ./configure)
|
||||
* Small (source and object)
|
||||
* Efficient (low CPU and memory usage)
|
||||
* Useful (avoid useless features almost no one needs)
|
||||
-488
@@ -1,488 +0,0 @@
|
||||
\input texinfo @c -*- texinfo -*-
|
||||
|
||||
@settitle FFmpeg FAQ
|
||||
@titlepage
|
||||
@sp 7
|
||||
@center @titlefont{FFmpeg FAQ}
|
||||
@sp 3
|
||||
@end titlepage
|
||||
|
||||
|
||||
@chapter General Questions
|
||||
|
||||
@section When will the next FFmpeg version be released? / Why are FFmpeg releases so few and far between?
|
||||
|
||||
Like most open source projects FFmpeg suffers from a certain lack of
|
||||
manpower. For this reason the developers have to prioritize the work
|
||||
they do and putting out releases is not at the top of the list, fixing
|
||||
bugs and reviewing patches takes precedence. Please don't complain or
|
||||
request more timely and/or frequent releases unless you are willing to
|
||||
help out creating them.
|
||||
|
||||
@section I have a problem with an old version of FFmpeg; where should I report it?
|
||||
Nowhere. Upgrade to the latest release or if there is no recent release upgrade
|
||||
to Subversion HEAD. You could also try to report it. Maybe you will get lucky and
|
||||
become the first person in history to get an answer different from "upgrade
|
||||
to Subversion HEAD".
|
||||
|
||||
@section Why doesn't FFmpeg support feature [xyz]?
|
||||
|
||||
Because no one has taken on that task yet. FFmpeg development is
|
||||
driven by the tasks that are important to the individual developers.
|
||||
If there is a feature that is important to you, the best way to get
|
||||
it implemented is to undertake the task yourself or sponsor a developer.
|
||||
|
||||
@section FFmpeg does not support codec XXX. Can you include a Windows DLL loader to support it?
|
||||
|
||||
No. Windows DLLs are not portable, bloated and often slow.
|
||||
Moreover FFmpeg strives to support all codecs natively.
|
||||
A DLL loader is not conducive to that goal.
|
||||
|
||||
@section My bug report/mail to ffmpeg-devel/user has not received any replies.
|
||||
|
||||
Likely reasons
|
||||
@itemize
|
||||
@item We are busy and haven't had time yet to read your report or
|
||||
investigate the issue.
|
||||
@item You didn't follow bugreports.html.
|
||||
@item You didn't use Subversion HEAD.
|
||||
@item You reported a segmentation fault without gdb output.
|
||||
@item You describe a problem but not how to reproduce it.
|
||||
@item It's unclear if you use ffmpeg as command line tool or use
|
||||
libav* from another application.
|
||||
@item You speak about a video having problems on playback but
|
||||
not what you use to play it.
|
||||
@item We have no faint clue what you are talking about besides
|
||||
that it is related to FFmpeg.
|
||||
@end itemize
|
||||
|
||||
@section Is there a forum for FFmpeg? I do not like mailing lists.
|
||||
|
||||
You may view our mailing lists with a more forum-alike look here:
|
||||
@url{http://dir.gmane.org/gmane.comp.video.ffmpeg.user},
|
||||
but, if you post, please remember that our mailing list rules still apply there.
|
||||
|
||||
@section I cannot read this file although this format seems to be supported by ffmpeg.
|
||||
|
||||
Even if ffmpeg can read the container format, it may not support all its
|
||||
codecs. Please consult the supported codec list in the ffmpeg
|
||||
documentation.
|
||||
|
||||
@section Which codecs are supported by Windows?
|
||||
|
||||
Windows does not support standard formats like MPEG very well, unless you
|
||||
install some additional codecs.
|
||||
|
||||
The following list of video codecs should work on most Windows systems:
|
||||
@table @option
|
||||
@item msmpeg4v2
|
||||
.avi/.asf
|
||||
@item msmpeg4
|
||||
.asf only
|
||||
@item wmv1
|
||||
.asf only
|
||||
@item wmv2
|
||||
.asf only
|
||||
@item mpeg4
|
||||
Only if you have some MPEG-4 codec like ffdshow or Xvid installed.
|
||||
@item mpeg1
|
||||
.mpg only
|
||||
@end table
|
||||
Note, ASF files often have .wmv or .wma extensions in Windows. It should also
|
||||
be mentioned that Microsoft claims a patent on the ASF format, and may sue
|
||||
or threaten users who create ASF files with non-Microsoft software. It is
|
||||
strongly advised to avoid ASF where possible.
|
||||
|
||||
The following list of audio codecs should work on most Windows systems:
|
||||
@table @option
|
||||
@item adpcm_ima_wav
|
||||
@item adpcm_ms
|
||||
@item pcm
|
||||
always
|
||||
@item mp3
|
||||
If some MP3 codec like LAME is installed.
|
||||
@end table
|
||||
|
||||
|
||||
@chapter Compilation
|
||||
|
||||
@section @code{error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'}
|
||||
|
||||
This is a bug in gcc. Do not report it to us. Instead, please report it to
|
||||
the gcc developers. Note that we will not add workarounds for gcc bugs.
|
||||
|
||||
Also note that (some of) the gcc developers believe this is not a bug or
|
||||
not a bug they should fix:
|
||||
@url{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203}.
|
||||
Then again, some of them do not know the difference between an undecidable
|
||||
problem and an NP-hard problem...
|
||||
|
||||
@chapter Usage
|
||||
|
||||
@section ffmpeg does not work; what is wrong?
|
||||
|
||||
Try a @code{make distclean} in the ffmpeg source directory before the build. If this does not help see
|
||||
(@url{http://ffmpeg.org/bugreports.html}).
|
||||
|
||||
@section How do I encode single pictures into movies?
|
||||
|
||||
First, rename your pictures to follow a numerical sequence.
|
||||
For example, img1.jpg, img2.jpg, img3.jpg,...
|
||||
Then you may run:
|
||||
|
||||
@example
|
||||
ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg
|
||||
@end example
|
||||
|
||||
Notice that @samp{%d} is replaced by the image number.
|
||||
|
||||
@file{img%03d.jpg} means the sequence @file{img001.jpg}, @file{img002.jpg}, etc...
|
||||
|
||||
The same logic is used for any image format that ffmpeg reads.
|
||||
|
||||
@section How do I encode movie to single pictures?
|
||||
|
||||
Use:
|
||||
|
||||
@example
|
||||
ffmpeg -i movie.mpg movie%d.jpg
|
||||
@end example
|
||||
|
||||
The @file{movie.mpg} used as input will be converted to
|
||||
@file{movie1.jpg}, @file{movie2.jpg}, etc...
|
||||
|
||||
Instead of relying on file format self-recognition, you may also use
|
||||
@table @option
|
||||
@item -vcodec ppm
|
||||
@item -vcodec png
|
||||
@item -vcodec mjpeg
|
||||
@end table
|
||||
to force the encoding.
|
||||
|
||||
Applying that to the previous example:
|
||||
@example
|
||||
ffmpeg -i movie.mpg -f image2 -vcodec mjpeg menu%d.jpg
|
||||
@end example
|
||||
|
||||
Beware that there is no "jpeg" codec. Use "mjpeg" instead.
|
||||
|
||||
@section Why do I see a slight quality degradation with multithreaded MPEG* encoding?
|
||||
|
||||
For multithreaded MPEG* encoding, the encoded slices must be independent,
|
||||
otherwise thread n would practically have to wait for n-1 to finish, so it's
|
||||
quite logical that there is a small reduction of quality. This is not a bug.
|
||||
|
||||
@section How can I read from the standard input or write to the standard output?
|
||||
|
||||
Use @file{-} as file name.
|
||||
|
||||
@section Why does FFmpeg not decode audio in VOB files?
|
||||
|
||||
The audio is AC-3 (a.k.a. A/52). AC-3 decoding is an optional component in FFmpeg
|
||||
as the component that handles AC-3 decoding is currently released under the GPL.
|
||||
Enable AC-3 decoding with @code{./configure --enable-gpl}. Take care: By
|
||||
enabling AC-3, you automatically change the license of libavcodec from
|
||||
LGPL to GPL.
|
||||
|
||||
@section Why does the chrominance data seem to be sampled at a different time from the luminance data on bt8x8 captures on Linux?
|
||||
|
||||
This is a well-known bug in the bt8x8 driver. For 2.4.26 there is a patch at
|
||||
(@url{http://svn.ffmpeg.org/michael/trunk/patches/bttv-420-2.4.26.patch?view=co}). This may also
|
||||
apply cleanly to other 2.4-series kernels.
|
||||
|
||||
@section How do I avoid the ugly aliasing artifacts in bt8x8 captures on Linux?
|
||||
|
||||
Pass 'combfilter=1 lumafilter=1' to the bttv driver. Note though that 'combfilter=1'
|
||||
will cause somewhat too strong filtering. A fix is to apply (@url{http://svn.ffmpeg.org/michael/trunk/patches/bttv-comb-2.4.26.patch?view=co})
|
||||
or (@url{http://svn.ffmpeg.org/michael/trunk/patches/bttv-comb-2.6.6.patch?view=co})
|
||||
and pass 'combfilter=2'.
|
||||
|
||||
@section -f jpeg doesn't work.
|
||||
|
||||
Try '-f image2 test%d.jpg'.
|
||||
|
||||
@section Why can I not change the framerate?
|
||||
|
||||
Some codecs, like MPEG-1/2, only allow a small number of fixed framerates.
|
||||
Choose a different codec with the -vcodec command line option.
|
||||
|
||||
@section How do I encode Xvid or DivX video with ffmpeg?
|
||||
|
||||
Both Xvid and DivX (version 4+) are implementations of the ISO MPEG-4
|
||||
standard (note that there are many other coding formats that use this
|
||||
same standard). Thus, use '-vcodec mpeg4' to encode in these formats. The
|
||||
default fourcc stored in an MPEG-4-coded file will be 'FMP4'. If you want
|
||||
a different fourcc, use the '-vtag' option. E.g., '-vtag xvid' will
|
||||
force the fourcc 'xvid' to be stored as the video fourcc rather than the
|
||||
default.
|
||||
|
||||
@section How do I encode videos which play on the iPod?
|
||||
|
||||
@table @option
|
||||
@item needed stuff
|
||||
-acodec libfaac -vcodec mpeg4 width<=320 height<=240
|
||||
@item working stuff
|
||||
4mv, title
|
||||
@item non-working stuff
|
||||
B-frames
|
||||
@item example command line
|
||||
ffmpeg -i input -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv -trellis 2 -aic 2 -cmp 2 -subcmp 2 -s 320x180 -title X output.mp4
|
||||
@end table
|
||||
|
||||
@section How do I encode videos which play on the PSP?
|
||||
|
||||
@table @option
|
||||
@item needed stuff
|
||||
-acodec libfaac -vcodec mpeg4 width*height<=76800 width%16=0 height%16=0 -ar 24000 -r 30000/1001 or 15000/1001 -f psp
|
||||
@item working stuff
|
||||
4mv, title
|
||||
@item non-working stuff
|
||||
B-frames
|
||||
@item example command line
|
||||
ffmpeg -i input -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -ar 24000 -mbd 2 -flags +4mv -trellis 2 -aic 2 -cmp 2 -subcmp 2 -s 368x192 -r 30000/1001 -title X -f psp output.mp4
|
||||
@item needed stuff for H.264
|
||||
-acodec libfaac -vcodec libx264 width*height<=76800 width%16=0? height%16=0? -ar 48000 -coder 1 -r 30000/1001 or 15000/1001 -f psp
|
||||
@item working stuff for H.264
|
||||
title, loop filter
|
||||
@item non-working stuff for H.264
|
||||
CAVLC
|
||||
@item example command line
|
||||
ffmpeg -i input -acodec libfaac -ab 128kb -vcodec libx264 -b 1200kb -ar 48000 -mbd 2 -coder 1 -cmp 2 -subcmp 2 -s 368x192 -r 30000/1001 -title X -f psp -flags loop -trellis 2 -partitions parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 output.mp4
|
||||
@item higher resolution for newer PSP firmwares, width<=480, height<=272
|
||||
-vcodec libx264 -level 21 -coder 1 -f psp
|
||||
@item example command line
|
||||
ffmpeg -i input -acodec libfaac -ab 128kb -ac 2 -ar 48000 -vcodec libx264 -level 21 -b 640kb -coder 1 -f psp -flags +loop -trellis 2 -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -g 250 -s 480x272 output.mp4
|
||||
@end table
|
||||
|
||||
@section Which are good parameters for encoding high quality MPEG-4?
|
||||
|
||||
'-mbd rd -flags +4mv+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 1/2',
|
||||
things to try: '-bf 2', '-flags qprd', '-flags mv0', '-flags skiprd'.
|
||||
|
||||
@section Which are good parameters for encoding high quality MPEG-1/MPEG-2?
|
||||
|
||||
'-mbd rd -trellis 2 -cmp 2 -subcmp 2 -g 100 -pass 1/2'
|
||||
but beware the '-g 100' might cause problems with some decoders.
|
||||
Things to try: '-bf 2', '-flags qprd', '-flags mv0', '-flags skiprd.
|
||||
|
||||
@section Interlaced video looks very bad when encoded with ffmpeg, what is wrong?
|
||||
|
||||
You should use '-flags +ilme+ildct' and maybe '-flags +alt' for interlaced
|
||||
material, and try '-top 0/1' if the result looks really messed-up.
|
||||
|
||||
@section How can I read DirectShow files?
|
||||
|
||||
If you have built FFmpeg with @code{./configure --enable-avisynth}
|
||||
(only possible on MinGW/Cygwin platforms),
|
||||
then you may use any file that DirectShow can read as input.
|
||||
(Be aware that this feature has been recently added,
|
||||
so you will need to help yourself in case of problems.)
|
||||
|
||||
Just create an "input.avs" text file with this single line ...
|
||||
@example
|
||||
DirectShowSource("C:\path to your file\yourfile.asf")
|
||||
@end example
|
||||
... and then feed that text file to FFmpeg:
|
||||
@example
|
||||
ffmpeg -i input.avs
|
||||
@end example
|
||||
|
||||
For ANY other help on Avisynth, please visit @url{http://www.avisynth.org/}.
|
||||
|
||||
@section How can I join video files?
|
||||
|
||||
A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow to join video files by
|
||||
merely concatenating them.
|
||||
|
||||
Hence you may concatenate your multimedia files by first transcoding them to
|
||||
these privileged formats, then using the humble @code{cat} command (or the
|
||||
equally humble @code{copy} under Windows), and finally transcoding back to your
|
||||
format of choice.
|
||||
|
||||
@example
|
||||
ffmpeg -i input1.avi -sameq intermediate1.mpg
|
||||
ffmpeg -i input2.avi -sameq intermediate2.mpg
|
||||
cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg
|
||||
ffmpeg -i intermediate_all.mpg -sameq output.avi
|
||||
@end example
|
||||
|
||||
Notice that you should either use @code{-sameq} or set a reasonably high
|
||||
bitrate for your intermediate and output files, if you want to preserve
|
||||
video quality.
|
||||
|
||||
Also notice that you may avoid the huge intermediate files by taking advantage
|
||||
of named pipes, should your platform support it:
|
||||
|
||||
@example
|
||||
mkfifo intermediate1.mpg
|
||||
mkfifo intermediate2.mpg
|
||||
ffmpeg -i input1.avi -sameq -y intermediate1.mpg < /dev/null &
|
||||
ffmpeg -i input2.avi -sameq -y intermediate2.mpg < /dev/null &
|
||||
cat intermediate1.mpg intermediate2.mpg |\
|
||||
ffmpeg -f mpeg -i - -sameq -vcodec mpeg4 -acodec libmp3lame output.avi
|
||||
@end example
|
||||
|
||||
Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also
|
||||
allow concatenation, and the transcoding step is almost lossless.
|
||||
|
||||
For example, let's say we want to join two FLV files into an output.flv file:
|
||||
|
||||
@example
|
||||
mkfifo temp1.a
|
||||
mkfifo temp1.v
|
||||
mkfifo temp2.a
|
||||
mkfifo temp2.v
|
||||
mkfifo all.a
|
||||
mkfifo all.v
|
||||
ffmpeg -i input1.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp1.a < /dev/null &
|
||||
ffmpeg -i input2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp2.a < /dev/null &
|
||||
ffmpeg -i input1.flv -an -f yuv4mpegpipe - > temp1.v < /dev/null &
|
||||
ffmpeg -i input2.flv -an -f yuv4mpegpipe - > temp2.v < /dev/null &
|
||||
cat temp1.a temp2.a > all.a &
|
||||
cat temp1.v temp2.v > all.v &
|
||||
ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \
|
||||
-f yuv4mpegpipe -i all.v \
|
||||
-sameq -y output.flv
|
||||
rm temp[12].[av] all.[av]
|
||||
@end example
|
||||
|
||||
@section FFmpeg does not adhere to the -maxrate setting, some frames are bigger than maxrate/fps.
|
||||
|
||||
Read the MPEG spec about video buffer verifier.
|
||||
|
||||
@section I want CBR, but no matter what I do frame sizes differ.
|
||||
|
||||
You do not understand what CBR is, please read the MPEG spec.
|
||||
Read about video buffer verifier and constant bitrate.
|
||||
The one sentence summary is that there is a buffer and the input rate is
|
||||
constant, the output can vary as needed.
|
||||
|
||||
@section How do I check if a stream is CBR?
|
||||
|
||||
To quote the MPEG-2 spec:
|
||||
"There is no way to tell that a bitstream is constant bitrate without
|
||||
examining all of the vbv_delay values and making complicated computations."
|
||||
|
||||
|
||||
@chapter Development
|
||||
|
||||
@section Are there examples illustrating how to use the FFmpeg libraries, particularly libavcodec and libavformat?
|
||||
|
||||
Yes. Read the Developers Guide of the FFmpeg documentation. Alternatively,
|
||||
examine the source code for one of the many open source projects that
|
||||
already incorporate FFmpeg at (@url{projects.html}).
|
||||
|
||||
@section Can you support my C compiler XXX?
|
||||
|
||||
It depends. If your compiler is C99-compliant, then patches to support
|
||||
it are likely to be welcome if they do not pollute the source code
|
||||
with @code{#ifdef}s related to the compiler.
|
||||
|
||||
@section Is Microsoft Visual C++ supported?
|
||||
|
||||
No. Microsoft Visual C++ is not compliant to the C99 standard and does
|
||||
not - among other things - support the inline assembly used in FFmpeg.
|
||||
If you wish to use MSVC++ for your
|
||||
project then you can link the MSVC++ code with libav* as long as
|
||||
you compile the latter with a working C compiler. For more information, see
|
||||
the @emph{Microsoft Visual C++ compatibility} section in the FFmpeg
|
||||
documentation.
|
||||
|
||||
There have been efforts to make FFmpeg compatible with MSVC++ in the
|
||||
past. However, they have all been rejected as too intrusive, especially
|
||||
since MinGW does the job adequately. None of the core developers
|
||||
work with MSVC++ and thus this item is low priority. Should you find
|
||||
the silver bullet that solves this problem, feel free to shoot it at us.
|
||||
|
||||
We strongly recommend you to move over from MSVC++ to MinGW tools.
|
||||
|
||||
@section Can I use FFmpeg or libavcodec under Windows?
|
||||
|
||||
Yes, but the Cygwin or MinGW tools @emph{must} be used to compile FFmpeg.
|
||||
Read the @emph{Windows} section in the FFmpeg documentation to find more
|
||||
information.
|
||||
|
||||
To get help and instructions for building FFmpeg under Windows, check out
|
||||
the FFmpeg Windows Help Forum at
|
||||
@url{http://ffmpeg.arrozcru.org/}.
|
||||
|
||||
@section Can you add automake, libtool or autoconf support?
|
||||
|
||||
No. These tools are too bloated and they complicate the build.
|
||||
|
||||
@section Why not rewrite ffmpeg in object-oriented C++?
|
||||
|
||||
FFmpeg is already organized in a highly modular manner and does not need to
|
||||
be rewritten in a formal object language. Further, many of the developers
|
||||
favor straight C; it works for them. For more arguments on this matter,
|
||||
read "Programming Religion" at (@url{http://www.tux.org/lkml/#s15}).
|
||||
|
||||
@section Why are the ffmpeg programs devoid of debugging symbols?
|
||||
|
||||
The build process creates ffmpeg_g, ffplay_g, etc. which contain full debug
|
||||
information. Those binaries are stripped to create ffmpeg, ffplay, etc. If
|
||||
you need the debug information, used the *_g versions.
|
||||
|
||||
@section I do not like the LGPL, can I contribute code under the GPL instead?
|
||||
|
||||
Yes, as long as the code is optional and can easily and cleanly be placed
|
||||
under #if CONFIG_GPL without breaking anything. So for example a new codec
|
||||
or filter would be OK under GPL while a bug fix to LGPL code would not.
|
||||
|
||||
@section I want to compile xyz.c alone but my compiler produced many errors.
|
||||
|
||||
Common code is in its own files in libav* and is used by the individual
|
||||
codecs. They will not work without the common parts, you have to compile
|
||||
the whole libav*. If you wish, disable some parts with configure switches.
|
||||
You can also try to hack it and remove more, but if you had problems fixing
|
||||
the compilation failure then you are probably not qualified for this.
|
||||
|
||||
@section I'm using libavcodec from within my C++ application but the linker complains about missing symbols which seem to be available.
|
||||
|
||||
FFmpeg is a pure C project, so to use the libraries within your C++ application
|
||||
you need to explicitly state that you are using a C library. You can do this by
|
||||
encompassing your FFmpeg includes using @code{extern "C"}.
|
||||
|
||||
See @url{http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-32.3}
|
||||
|
||||
@section I have a file in memory / a API different from *open/*read/ libc how do I use it with libavformat?
|
||||
|
||||
You have to implement a URLProtocol, see libavformat/file.c in FFmpeg
|
||||
and libmpdemux/demux_lavf.c in MPlayer sources.
|
||||
|
||||
@section I get "No compatible shell script interpreter found." in MSys.
|
||||
|
||||
The standard MSys bash (2.04) is broken. You need to install 2.05 or later.
|
||||
|
||||
@section I get "./configure: line <xxx>: pr: command not found" in MSys.
|
||||
|
||||
The standard MSys install doesn't come with pr. You need to get it from the coreutils package.
|
||||
|
||||
@section I tried to pass RTP packets into a decoder, but it doesn't work.
|
||||
|
||||
RTP is a container format like any other, you must first depacketize the
|
||||
codec frames/samples stored in RTP and then feed to the decoder.
|
||||
|
||||
@section Where can I find libav* headers for Pascal/Delphi?
|
||||
|
||||
see @url{http://www.iversenit.dk/dev/ffmpeg-headers/}
|
||||
|
||||
@section Where is the documentation about ffv1, msmpeg4, asv1, 4xm?
|
||||
|
||||
see @url{http://svn.ffmpeg.org/michael/trunk/docs/}
|
||||
|
||||
@section How do I feed H.263-RTP (and other codecs in RTP) to libavcodec?
|
||||
|
||||
Even if peculiar since it is network oriented, RTP is a container like any
|
||||
other. You have to @emph{demux} RTP before feeding the payload to libavcodec.
|
||||
In this specific case please look at RFC 4629 to see how it should be done.
|
||||
|
||||
@section AVStream.r_frame_rate is wrong, it is much larger than the framerate.
|
||||
|
||||
r_frame_rate is NOT the average framerate, it is the smallest framerate
|
||||
that can accurately represent all timestamps. So no, it is not
|
||||
wrong if it is larger than the average!
|
||||
For example, if you have mixed 25 and 30 fps content, then r_frame_rate
|
||||
will be 150.
|
||||
|
||||
@bye
|
||||
@@ -1,969 +0,0 @@
|
||||
\input texinfo @c -*- texinfo -*-
|
||||
|
||||
@settitle FFmpeg Documentation
|
||||
@titlepage
|
||||
@sp 7
|
||||
@center @titlefont{FFmpeg Documentation}
|
||||
@sp 3
|
||||
@end titlepage
|
||||
|
||||
|
||||
@chapter Introduction
|
||||
|
||||
FFmpeg is a very fast video and audio converter. It can also grab from
|
||||
a live audio/video source.
|
||||
|
||||
The command line interface is designed to be intuitive, in the sense
|
||||
that FFmpeg tries to figure out all parameters that can possibly be
|
||||
derived automatically. You usually only have to specify the target
|
||||
bitrate you want.
|
||||
|
||||
FFmpeg can also convert from any sample rate to any other, and resize
|
||||
video on the fly with a high quality polyphase filter.
|
||||
|
||||
@chapter Quick Start
|
||||
|
||||
@c man begin EXAMPLES
|
||||
@section Video and Audio grabbing
|
||||
|
||||
FFmpeg can grab video and audio from devices given that you specify the input
|
||||
format and device.
|
||||
|
||||
@example
|
||||
ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
|
||||
@end example
|
||||
|
||||
Note that you must activate the right video source and channel before
|
||||
launching FFmpeg with any TV viewer such as xawtv
|
||||
(@url{http://linux.bytesex.org/xawtv/}) by Gerd Knorr. You also
|
||||
have to set the audio recording levels correctly with a
|
||||
standard mixer.
|
||||
|
||||
@section X11 grabbing
|
||||
|
||||
FFmpeg can grab the X11 display.
|
||||
|
||||
@example
|
||||
ffmpeg -f x11grab -s cif -i :0.0 /tmp/out.mpg
|
||||
@end example
|
||||
|
||||
0.0 is display.screen number of your X11 server, same as
|
||||
the DISPLAY environment variable.
|
||||
|
||||
@example
|
||||
ffmpeg -f x11grab -s cif -i :0.0+10,20 /tmp/out.mpg
|
||||
@end example
|
||||
|
||||
0.0 is display.screen number of your X11 server, same as the DISPLAY environment
|
||||
variable. 10 is the x-offset and 20 the y-offset for the grabbing.
|
||||
|
||||
@section Video and Audio file format conversion
|
||||
|
||||
* FFmpeg can use any supported file format and protocol as input:
|
||||
|
||||
Examples:
|
||||
|
||||
* You can use YUV files as input:
|
||||
|
||||
@example
|
||||
ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
|
||||
@end example
|
||||
|
||||
It will use the files:
|
||||
@example
|
||||
/tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
|
||||
/tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
|
||||
@end example
|
||||
|
||||
The Y files use twice the resolution of the U and V files. They are
|
||||
raw files, without header. They can be generated by all decent video
|
||||
decoders. You must specify the size of the image with the @option{-s} option
|
||||
if FFmpeg cannot guess it.
|
||||
|
||||
* You can input from a raw YUV420P file:
|
||||
|
||||
@example
|
||||
ffmpeg -i /tmp/test.yuv /tmp/out.avi
|
||||
@end example
|
||||
|
||||
test.yuv is a file containing raw YUV planar data. Each frame is composed
|
||||
of the Y plane followed by the U and V planes at half vertical and
|
||||
horizontal resolution.
|
||||
|
||||
* You can output to a raw YUV420P file:
|
||||
|
||||
@example
|
||||
ffmpeg -i mydivx.avi hugefile.yuv
|
||||
@end example
|
||||
|
||||
* You can set several input files and output files:
|
||||
|
||||
@example
|
||||
ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
|
||||
@end example
|
||||
|
||||
Converts the audio file a.wav and the raw YUV video file a.yuv
|
||||
to MPEG file a.mpg.
|
||||
|
||||
* You can also do audio and video conversions at the same time:
|
||||
|
||||
@example
|
||||
ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
|
||||
@end example
|
||||
|
||||
Converts a.wav to MPEG audio at 22050 Hz sample rate.
|
||||
|
||||
* You can encode to several formats at the same time and define a
|
||||
mapping from input stream to output streams:
|
||||
|
||||
@example
|
||||
ffmpeg -i /tmp/a.wav -ab 64k /tmp/a.mp2 -ab 128k /tmp/b.mp2 -map 0:0 -map 0:0
|
||||
@end example
|
||||
|
||||
Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map
|
||||
file:index' specifies which input stream is used for each output
|
||||
stream, in the order of the definition of output streams.
|
||||
|
||||
* You can transcode decrypted VOBs:
|
||||
|
||||
@example
|
||||
ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 128k snatch.avi
|
||||
@end example
|
||||
|
||||
This is a typical DVD ripping example; the input is a VOB file, the
|
||||
output an AVI file with MPEG-4 video and MP3 audio. Note that in this
|
||||
command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
|
||||
GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
|
||||
input video. Furthermore, the audio stream is MP3-encoded so you need
|
||||
to enable LAME support by passing @code{--enable-libmp3lame} to configure.
|
||||
The mapping is particularly useful for DVD transcoding
|
||||
to get the desired audio language.
|
||||
|
||||
NOTE: To see the supported input formats, use @code{ffmpeg -formats}.
|
||||
|
||||
* You can extract images from a video, or create a video from many images:
|
||||
|
||||
For extracting images from a video:
|
||||
@example
|
||||
ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
|
||||
@end example
|
||||
|
||||
This will extract one video frame per second from the video and will
|
||||
output them in files named @file{foo-001.jpeg}, @file{foo-002.jpeg},
|
||||
etc. Images will be rescaled to fit the new WxH values.
|
||||
|
||||
If you want to extract just a limited number of frames, you can use the
|
||||
above command in combination with the -vframes or -t option, or in
|
||||
combination with -ss to start extracting from a certain point in time.
|
||||
|
||||
For creating a video from many images:
|
||||
@example
|
||||
ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
|
||||
@end example
|
||||
|
||||
The syntax @code{foo-%03d.jpeg} specifies to use a decimal number
|
||||
composed of three digits padded with zeroes to express the sequence
|
||||
number. It is the same syntax supported by the C printf function, but
|
||||
only formats accepting a normal integer are suitable.
|
||||
|
||||
* You can put many streams of the same type in the output:
|
||||
|
||||
@example
|
||||
ffmpeg -i test1.avi -i test2.avi -vcodec copy -acodec copy -vcodec copy -acodec copy test12.avi -newvideo -newaudio
|
||||
@end example
|
||||
|
||||
In addition to the first video and audio streams, the resulting
|
||||
output file @file{test12.avi} will contain the second video
|
||||
and the second audio stream found in the input streams list.
|
||||
|
||||
The @code{-newvideo}, @code{-newaudio} and @code{-newsubtitle}
|
||||
options have to be specified immediately after the name of the output
|
||||
file to which you want to add them.
|
||||
@c man end
|
||||
|
||||
@chapter Invocation
|
||||
|
||||
@section Syntax
|
||||
|
||||
The generic syntax is:
|
||||
|
||||
@example
|
||||
@c man begin SYNOPSIS
|
||||
ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
|
||||
@c man end
|
||||
@end example
|
||||
@c man begin DESCRIPTION
|
||||
As a general rule, options are applied to the next specified
|
||||
file. Therefore, order is important, and you can have the same
|
||||
option on the command line multiple times. Each occurrence is
|
||||
then applied to the next input or output file.
|
||||
|
||||
* To set the video bitrate of the output file to 64kbit/s:
|
||||
@example
|
||||
ffmpeg -i input.avi -b 64k output.avi
|
||||
@end example
|
||||
|
||||
* To force the frame rate of the output file to 24 fps:
|
||||
@example
|
||||
ffmpeg -i input.avi -r 24 output.avi
|
||||
@end example
|
||||
|
||||
* To force the frame rate of the input file (valid for raw formats only)
|
||||
to 1 fps and the frame rate of the output file to 24 fps:
|
||||
@example
|
||||
ffmpeg -r 1 -i input.m2v -r 24 output.avi
|
||||
@end example
|
||||
|
||||
The format option may be needed for raw input files.
|
||||
|
||||
By default, FFmpeg tries to convert as losslessly as possible: It
|
||||
uses the same audio and video parameters for the outputs as the one
|
||||
specified for the inputs.
|
||||
@c man end
|
||||
|
||||
@c man begin OPTIONS
|
||||
@section Main options
|
||||
|
||||
@table @option
|
||||
@item -L
|
||||
Show license.
|
||||
|
||||
@item -h
|
||||
Show help.
|
||||
|
||||
@item -version
|
||||
Show version.
|
||||
|
||||
@item -formats
|
||||
Show available formats, codecs, bitstream filters, protocols, and frame size and frame rate abbreviations.
|
||||
|
||||
The fields preceding the format and codec names have the following meanings:
|
||||
@table @samp
|
||||
@item D
|
||||
Decoding available
|
||||
@item E
|
||||
Encoding available
|
||||
@item V/A/S
|
||||
Video/audio/subtitle codec
|
||||
@item S
|
||||
Codec supports slices
|
||||
@item D
|
||||
Codec supports direct rendering
|
||||
@item T
|
||||
Codec can handle input truncated at random locations instead of only at frame boundaries
|
||||
@end table
|
||||
|
||||
@item -f @var{fmt}
|
||||
Force format.
|
||||
|
||||
@item -i @var{filename}
|
||||
input file name
|
||||
|
||||
@item -y
|
||||
Overwrite output files.
|
||||
|
||||
@item -t @var{duration}
|
||||
Restrict the transcoded/captured video sequence
|
||||
to the duration specified in seconds.
|
||||
@code{hh:mm:ss[.xxx]} syntax is also supported.
|
||||
|
||||
@item -fs @var{limit_size}
|
||||
Set the file size limit.
|
||||
|
||||
@item -ss @var{position}
|
||||
Seek to given time position in seconds.
|
||||
@code{hh:mm:ss[.xxx]} syntax is also supported.
|
||||
|
||||
@item -itsoffset @var{offset}
|
||||
Set the input time offset in seconds.
|
||||
@code{[-]hh:mm:ss[.xxx]} syntax is also supported.
|
||||
This option affects all the input files that follow it.
|
||||
The offset is added to the timestamps of the input files.
|
||||
Specifying a positive offset means that the corresponding
|
||||
streams are delayed by 'offset' seconds.
|
||||
|
||||
@item -timestamp @var{time}
|
||||
Set the timestamp.
|
||||
|
||||
@item -metadata @var{key}=@var{value}
|
||||
Set a metadata key/value pair.
|
||||
|
||||
For example, for setting the title in the output file:
|
||||
@example
|
||||
ffmpeg -i in.avi -metadata title="my title" out.flv
|
||||
@end example
|
||||
|
||||
@item -v @var{number}
|
||||
Set the logging verbosity level.
|
||||
|
||||
@item -target @var{type}
|
||||
Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd",
|
||||
"ntsc-svcd", ... ). All the format options (bitrate, codecs,
|
||||
buffer sizes) are then set automatically. You can just type:
|
||||
|
||||
@example
|
||||
ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
|
||||
@end example
|
||||
|
||||
Nevertheless you can specify additional options as long as you know
|
||||
they do not conflict with the standard, as in:
|
||||
|
||||
@example
|
||||
ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
|
||||
@end example
|
||||
|
||||
@item -dframes @var{number}
|
||||
Set the number of data frames to record.
|
||||
|
||||
@item -scodec @var{codec}
|
||||
Force subtitle codec ('copy' to copy stream).
|
||||
|
||||
@item -newsubtitle
|
||||
Add a new subtitle stream to the current output stream.
|
||||
|
||||
@item -slang @var{code}
|
||||
Set the ISO 639 language code (3 letters) of the current subtitle stream.
|
||||
|
||||
@end table
|
||||
|
||||
@section Video Options
|
||||
|
||||
@table @option
|
||||
@item -b @var{bitrate}
|
||||
Set the video bitrate in bit/s (default = 200 kb/s).
|
||||
@item -vframes @var{number}
|
||||
Set the number of video frames to record.
|
||||
@item -r @var{fps}
|
||||
Set frame rate (Hz value, fraction or abbreviation), (default = 25).
|
||||
@item -s @var{size}
|
||||
Set frame size. The format is @samp{wxh} (ffserver default = 160x128, ffmpeg default = same as source).
|
||||
The following abbreviations are recognized:
|
||||
@table @samp
|
||||
@item sqcif
|
||||
128x96
|
||||
@item qcif
|
||||
176x144
|
||||
@item cif
|
||||
352x288
|
||||
@item 4cif
|
||||
704x576
|
||||
@item qqvga
|
||||
160x120
|
||||
@item qvga
|
||||
320x240
|
||||
@item vga
|
||||
640x480
|
||||
@item svga
|
||||
800x600
|
||||
@item xga
|
||||
1024x768
|
||||
@item uxga
|
||||
1600x1200
|
||||
@item qxga
|
||||
2048x1536
|
||||
@item sxga
|
||||
1280x1024
|
||||
@item qsxga
|
||||
2560x2048
|
||||
@item hsxga
|
||||
5120x4096
|
||||
@item wvga
|
||||
852x480
|
||||
@item wxga
|
||||
1366x768
|
||||
@item wsxga
|
||||
1600x1024
|
||||
@item wuxga
|
||||
1920x1200
|
||||
@item woxga
|
||||
2560x1600
|
||||
@item wqsxga
|
||||
3200x2048
|
||||
@item wquxga
|
||||
3840x2400
|
||||
@item whsxga
|
||||
6400x4096
|
||||
@item whuxga
|
||||
7680x4800
|
||||
@item cga
|
||||
320x200
|
||||
@item ega
|
||||
640x350
|
||||
@item hd480
|
||||
852x480
|
||||
@item hd720
|
||||
1280x720
|
||||
@item hd1080
|
||||
1920x1080
|
||||
@end table
|
||||
|
||||
@item -aspect @var{aspect}
|
||||
Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).
|
||||
@item -croptop @var{size}
|
||||
Set top crop band size (in pixels).
|
||||
@item -cropbottom @var{size}
|
||||
Set bottom crop band size (in pixels).
|
||||
@item -cropleft @var{size}
|
||||
Set left crop band size (in pixels).
|
||||
@item -cropright @var{size}
|
||||
Set right crop band size (in pixels).
|
||||
@item -padtop @var{size}
|
||||
Set top pad band size (in pixels).
|
||||
@item -padbottom @var{size}
|
||||
Set bottom pad band size (in pixels).
|
||||
@item -padleft @var{size}
|
||||
Set left pad band size (in pixels).
|
||||
@item -padright @var{size}
|
||||
Set right pad band size (in pixels).
|
||||
@item -padcolor @var{hex_color}
|
||||
Set color of padded bands. The value for padcolor is expressed
|
||||
as a six digit hexadecimal number where the first two digits
|
||||
represent red, the middle two digits green and last two digits
|
||||
blue (default = 000000 (black)).
|
||||
@item -vn
|
||||
Disable video recording.
|
||||
@item -bt @var{tolerance}
|
||||
Set video bitrate tolerance (in bits, default 4000k).
|
||||
Has a minimum value of: (target_bitrate/target_framerate).
|
||||
In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
|
||||
willing to deviate from the target average bitrate value. This is
|
||||
not related to min/max bitrate. Lowering tolerance too much has
|
||||
an adverse effect on quality.
|
||||
@item -maxrate @var{bitrate}
|
||||
Set max video bitrate (in bit/s).
|
||||
Requires -bufsize to be set.
|
||||
@item -minrate @var{bitrate}
|
||||
Set min video bitrate (in bit/s).
|
||||
Most useful in setting up a CBR encode:
|
||||
@example
|
||||
ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
|
||||
@end example
|
||||
It is of little use elsewise.
|
||||
@item -bufsize @var{size}
|
||||
Set video buffer verifier buffer size (in bits).
|
||||
@item -vcodec @var{codec}
|
||||
Force video codec to @var{codec}. Use the @code{copy} special value to
|
||||
tell that the raw codec data must be copied as is.
|
||||
@item -sameq
|
||||
Use same video quality as source (implies VBR).
|
||||
|
||||
@item -pass @var{n}
|
||||
Select the pass number (1 or 2). It is used to do two-pass
|
||||
video encoding. The statistics of the video are recorded in the first
|
||||
pass into a log file (see also the option -passlogfile),
|
||||
and in the second pass that log file is used to generate the video
|
||||
at the exact requested bitrate.
|
||||
On pass 1, you may just deactivate audio and set output to null,
|
||||
examples for Windows and Unix:
|
||||
@example
|
||||
ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y NUL
|
||||
ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y /dev/null
|
||||
@end example
|
||||
|
||||
@item -passlogfile @var{prefix}
|
||||
Set two-pass log file name prefix to @var{prefix}, the default file name
|
||||
prefix is ``ffmpeg2pass''. The complete file name will be
|
||||
@file{PREFIX-N.log}, where N is a number specific to the output
|
||||
stream.
|
||||
|
||||
@item -newvideo
|
||||
Add a new video stream to the current output stream.
|
||||
|
||||
@end table
|
||||
|
||||
@section Advanced Video Options
|
||||
|
||||
@table @option
|
||||
@item -pix_fmt @var{format}
|
||||
Set pixel format. Use 'list' as parameter to show all the supported
|
||||
pixel formats.
|
||||
@item -sws_flags @var{flags}
|
||||
Set SwScaler flags (only available when compiled with swscale support).
|
||||
@item -g @var{gop_size}
|
||||
Set the group of pictures size.
|
||||
@item -intra
|
||||
Use only intra frames.
|
||||
@item -vdt @var{n}
|
||||
Discard threshold.
|
||||
@item -qscale @var{q}
|
||||
Use fixed video quantizer scale (VBR).
|
||||
@item -qmin @var{q}
|
||||
minimum video quantizer scale (VBR)
|
||||
@item -qmax @var{q}
|
||||
maximum video quantizer scale (VBR)
|
||||
@item -qdiff @var{q}
|
||||
maximum difference between the quantizer scales (VBR)
|
||||
@item -qblur @var{blur}
|
||||
video quantizer scale blur (VBR) (range 0.0 - 1.0)
|
||||
@item -qcomp @var{compression}
|
||||
video quantizer scale compression (VBR) (default 0.5).
|
||||
Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
|
||||
|
||||
@item -lmin @var{lambda}
|
||||
minimum video lagrange factor (VBR)
|
||||
@item -lmax @var{lambda}
|
||||
max video lagrange factor (VBR)
|
||||
@item -mblmin @var{lambda}
|
||||
minimum macroblock quantizer scale (VBR)
|
||||
@item -mblmax @var{lambda}
|
||||
maximum macroblock quantizer scale (VBR)
|
||||
|
||||
These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units,
|
||||
but you may use the QP2LAMBDA constant to easily convert from 'q' units:
|
||||
@example
|
||||
ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
|
||||
@end example
|
||||
|
||||
@item -rc_init_cplx @var{complexity}
|
||||
initial complexity for single pass encoding
|
||||
@item -b_qfactor @var{factor}
|
||||
qp factor between P- and B-frames
|
||||
@item -i_qfactor @var{factor}
|
||||
qp factor between P- and I-frames
|
||||
@item -b_qoffset @var{offset}
|
||||
qp offset between P- and B-frames
|
||||
@item -i_qoffset @var{offset}
|
||||
qp offset between P- and I-frames
|
||||
@item -rc_eq @var{equation}
|
||||
Set rate control equation (@pxref{FFmpeg formula
|
||||
evaluator}) (default = @code{tex^qComp}).
|
||||
@item -rc_override @var{override}
|
||||
rate control override for specific intervals
|
||||
@item -me_method @var{method}
|
||||
Set motion estimation method to @var{method}.
|
||||
Available methods are (from lowest to best quality):
|
||||
@table @samp
|
||||
@item zero
|
||||
Try just the (0, 0) vector.
|
||||
@item phods
|
||||
@item log
|
||||
@item x1
|
||||
@item hex
|
||||
@item umh
|
||||
@item epzs
|
||||
(default method)
|
||||
@item full
|
||||
exhaustive search (slow and marginally better than epzs)
|
||||
@end table
|
||||
|
||||
@item -dct_algo @var{algo}
|
||||
Set DCT algorithm to @var{algo}. Available values are:
|
||||
@table @samp
|
||||
@item 0
|
||||
FF_DCT_AUTO (default)
|
||||
@item 1
|
||||
FF_DCT_FASTINT
|
||||
@item 2
|
||||
FF_DCT_INT
|
||||
@item 3
|
||||
FF_DCT_MMX
|
||||
@item 4
|
||||
FF_DCT_MLIB
|
||||
@item 5
|
||||
FF_DCT_ALTIVEC
|
||||
@end table
|
||||
|
||||
@item -idct_algo @var{algo}
|
||||
Set IDCT algorithm to @var{algo}. Available values are:
|
||||
@table @samp
|
||||
@item 0
|
||||
FF_IDCT_AUTO (default)
|
||||
@item 1
|
||||
FF_IDCT_INT
|
||||
@item 2
|
||||
FF_IDCT_SIMPLE
|
||||
@item 3
|
||||
FF_IDCT_SIMPLEMMX
|
||||
@item 4
|
||||
FF_IDCT_LIBMPEG2MMX
|
||||
@item 5
|
||||
FF_IDCT_PS2
|
||||
@item 6
|
||||
FF_IDCT_MLIB
|
||||
@item 7
|
||||
FF_IDCT_ARM
|
||||
@item 8
|
||||
FF_IDCT_ALTIVEC
|
||||
@item 9
|
||||
FF_IDCT_SH4
|
||||
@item 10
|
||||
FF_IDCT_SIMPLEARM
|
||||
@end table
|
||||
|
||||
@item -er @var{n}
|
||||
Set error resilience to @var{n}.
|
||||
@table @samp
|
||||
@item 1
|
||||
FF_ER_CAREFUL (default)
|
||||
@item 2
|
||||
FF_ER_COMPLIANT
|
||||
@item 3
|
||||
FF_ER_AGGRESSIVE
|
||||
@item 4
|
||||
FF_ER_VERY_AGGRESSIVE
|
||||
@end table
|
||||
|
||||
@item -ec @var{bit_mask}
|
||||
Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
|
||||
the following values:
|
||||
@table @samp
|
||||
@item 1
|
||||
FF_EC_GUESS_MVS (default = enabled)
|
||||
@item 2
|
||||
FF_EC_DEBLOCK (default = enabled)
|
||||
@end table
|
||||
|
||||
@item -bf @var{frames}
|
||||
Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
|
||||
@item -mbd @var{mode}
|
||||
macroblock decision
|
||||
@table @samp
|
||||
@item 0
|
||||
FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg).
|
||||
@item 1
|
||||
FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
|
||||
@item 2
|
||||
FF_MB_DECISION_RD: rate distortion
|
||||
@end table
|
||||
|
||||
@item -4mv
|
||||
Use four motion vector by macroblock (MPEG-4 only).
|
||||
@item -part
|
||||
Use data partitioning (MPEG-4 only).
|
||||
@item -bug @var{param}
|
||||
Work around encoder bugs that are not auto-detected.
|
||||
@item -strict @var{strictness}
|
||||
How strictly to follow the standards.
|
||||
@item -aic
|
||||
Enable Advanced intra coding (h263+).
|
||||
@item -umv
|
||||
Enable Unlimited Motion Vector (h263+)
|
||||
|
||||
@item -deinterlace
|
||||
Deinterlace pictures.
|
||||
@item -ilme
|
||||
Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
|
||||
Use this option if your input file is interlaced and you want
|
||||
to keep the interlaced format for minimum losses.
|
||||
The alternative is to deinterlace the input stream with
|
||||
@option{-deinterlace}, but deinterlacing introduces losses.
|
||||
@item -psnr
|
||||
Calculate PSNR of compressed frames.
|
||||
@item -vstats
|
||||
Dump video coding statistics to @file{vstats_HHMMSS.log}.
|
||||
@item -vstats_file @var{file}
|
||||
Dump video coding statistics to @var{file}.
|
||||
@item -vhook @var{module}
|
||||
Insert video processing @var{module}. @var{module} contains the module
|
||||
name and its parameters separated by spaces.
|
||||
@item -top @var{n}
|
||||
top=1/bottom=0/auto=-1 field first
|
||||
@item -dc @var{precision}
|
||||
Intra_dc_precision.
|
||||
@item -vtag @var{fourcc/tag}
|
||||
Force video tag/fourcc.
|
||||
@item -qphist
|
||||
Show QP histogram.
|
||||
@item -vbsf @var{bitstream_filter}
|
||||
Bitstream filters available are "dump_extra", "remove_extra", "noise", "h264_mp4toannexb", "imxdump", "mjpegadump".
|
||||
@example
|
||||
ffmpeg -i h264.mp4 -vcodec copy -vbsf h264_mp4toannexb -an out.h264
|
||||
@end example
|
||||
@end table
|
||||
|
||||
@section Audio Options
|
||||
|
||||
@table @option
|
||||
@item -aframes @var{number}
|
||||
Set the number of audio frames to record.
|
||||
@item -ar @var{freq}
|
||||
Set the audio sampling frequency (default = 44100 Hz).
|
||||
@item -ab @var{bitrate}
|
||||
Set the audio bitrate in bit/s (default = 64k).
|
||||
@item -aq @var{q}
|
||||
Set the audio quality (codec-specific, VBR).
|
||||
@item -ac @var{channels}
|
||||
Set the number of audio channels (default = 1).
|
||||
@item -an
|
||||
Disable audio recording.
|
||||
@item -acodec @var{codec}
|
||||
Force audio codec to @var{codec}. Use the @code{copy} special value to
|
||||
specify that the raw codec data must be copied as is.
|
||||
@item -newaudio
|
||||
Add a new audio track to the output file. If you want to specify parameters,
|
||||
do so before @code{-newaudio} (@code{-acodec}, @code{-ab}, etc..).
|
||||
|
||||
Mapping will be done automatically, if the number of output streams is equal to
|
||||
the number of input streams, else it will pick the first one that matches. You
|
||||
can override the mapping using @code{-map} as usual.
|
||||
|
||||
Example:
|
||||
@example
|
||||
ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio
|
||||
@end example
|
||||
@item -alang @var{code}
|
||||
Set the ISO 639 language code (3 letters) of the current audio stream.
|
||||
@end table
|
||||
|
||||
@section Advanced Audio options:
|
||||
|
||||
@table @option
|
||||
@item -atag @var{fourcc/tag}
|
||||
Force audio tag/fourcc.
|
||||
@item -absf @var{bitstream_filter}
|
||||
Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp".
|
||||
@end table
|
||||
|
||||
@section Subtitle options:
|
||||
|
||||
@table @option
|
||||
@item -scodec @var{codec}
|
||||
Force subtitle codec ('copy' to copy stream).
|
||||
@item -newsubtitle
|
||||
Add a new subtitle stream to the current output stream.
|
||||
@item -slang @var{code}
|
||||
Set the ISO 639 language code (3 letters) of the current subtitle stream.
|
||||
@item -sn
|
||||
Disable subtitle recording.
|
||||
@item -sbsf @var{bitstream_filter}
|
||||
Bitstream filters available are "mov2textsub", "text2movsub".
|
||||
@example
|
||||
ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt
|
||||
@end example
|
||||
@end table
|
||||
|
||||
@section Audio/Video grab options
|
||||
|
||||
@table @option
|
||||
@item -vc @var{channel}
|
||||
Set video grab channel (DV1394 only).
|
||||
@item -tvstd @var{standard}
|
||||
Set television standard (NTSC, PAL (SECAM)).
|
||||
@item -isync
|
||||
Synchronize read on input.
|
||||
@end table
|
||||
|
||||
@section Advanced options
|
||||
|
||||
@table @option
|
||||
@item -map @var{input_stream_id}[:@var{sync_stream_id}]
|
||||
Set stream mapping from input streams to output streams.
|
||||
Just enumerate the input streams in the order you want them in the output.
|
||||
@var{sync_stream_id} if specified sets the input stream to sync
|
||||
against.
|
||||
@item -map_meta_data @var{outfile}:@var{infile}
|
||||
Set meta data information of @var{outfile} from @var{infile}.
|
||||
@item -debug
|
||||
Print specific debug info.
|
||||
@item -benchmark
|
||||
Add timings for benchmarking.
|
||||
@item -dump
|
||||
Dump each input packet.
|
||||
@item -hex
|
||||
When dumping packets, also dump the payload.
|
||||
@item -bitexact
|
||||
Only use bit exact algorithms (for codec testing).
|
||||
@item -ps @var{size}
|
||||
Set packet size in bits.
|
||||
@item -re
|
||||
Read input at native frame rate. Mainly used to simulate a grab device.
|
||||
@item -loop_input
|
||||
Loop over the input stream. Currently it works only for image
|
||||
streams. This option is used for automatic FFserver testing.
|
||||
@item -loop_output @var{number_of_times}
|
||||
Repeatedly loop output for formats that support looping such as animated GIF
|
||||
(0 will loop the output infinitely).
|
||||
@item -threads @var{count}
|
||||
Thread count.
|
||||
@item -vsync @var{parameter}
|
||||
Video sync method. Video will be stretched/squeezed to match the timestamps,
|
||||
it is done by duplicating and dropping frames. With -map you can select from
|
||||
which stream the timestamps should be taken. You can leave either video or
|
||||
audio unchanged and sync the remaining stream(s) to the unchanged one.
|
||||
@item -async @var{samples_per_second}
|
||||
Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps,
|
||||
the parameter is the maximum samples per second by which the audio is changed.
|
||||
-async 1 is a special case where only the start of the audio stream is corrected
|
||||
without any later correction.
|
||||
@item -copyts
|
||||
Copy timestamps from input to output.
|
||||
@item -shortest
|
||||
Finish encoding when the shortest input stream ends.
|
||||
@item -dts_delta_threshold
|
||||
Timestamp discontinuity delta threshold.
|
||||
@item -muxdelay @var{seconds}
|
||||
Set the maximum demux-decode delay.
|
||||
@item -muxpreload @var{seconds}
|
||||
Set the initial demux-decode delay.
|
||||
@end table
|
||||
|
||||
@section Preset files
|
||||
|
||||
A preset file contains a sequence of @var{option}=@var{value} pairs,
|
||||
one for each line, specifying a sequence of options which would be
|
||||
awkward to specify on the command line. Lines starting with the hash
|
||||
('#') character are ignored and are used to provide comments. Check
|
||||
the @file{ffpresets} directory in the FFmpeg source tree for examples.
|
||||
|
||||
Preset files are specified with the @code{vpre}, @code{apre} and
|
||||
@code{spre} options. The options specified in a preset file are
|
||||
applied to the currently selected codec of the same type as the preset
|
||||
option.
|
||||
|
||||
The argument passed to the preset options identifies the preset file
|
||||
to use according to the following rules.
|
||||
|
||||
First ffmpeg searches for a file named @var{arg}.ffpreset in the
|
||||
directories @file{$HOME/.ffmpeg}, and in the datadir defined at
|
||||
configuration time (usually @file{PREFIX/share/ffmpeg}) in that
|
||||
order. For example, if the argument is @code{libx264-max}, it will
|
||||
search for the file @file{libx264-max.ffpreset}.
|
||||
|
||||
If no such file is found, then ffmpeg will search for a file named
|
||||
@var{codec_name}-@var{arg}.ffpreset in the above-mentioned
|
||||
directories, where @var{codec_name} is the name of the codec to which
|
||||
the preset file options will be applied. For example, if you select
|
||||
the video codec with @code{-vcodec libx264} and use @code{-vpre max},
|
||||
then it will search for the file @file{libx264-max.ffpreset}.
|
||||
|
||||
Finally, if the above rules failed and the argument specifies an
|
||||
absolute pathname, ffmpeg will search for that filename. This way you
|
||||
can specify the absolute and complete filename of the preset file, for
|
||||
example @file{./ffpresets/libx264-max.ffpreset}.
|
||||
|
||||
@node FFmpeg formula evaluator
|
||||
@section FFmpeg formula evaluator
|
||||
|
||||
When evaluating a rate control string, FFmpeg uses an internal formula
|
||||
evaluator.
|
||||
|
||||
The following binary operators are available: @code{+}, @code{-},
|
||||
@code{*}, @code{/}, @code{^}.
|
||||
|
||||
The following unary operators are available: @code{+}, @code{-},
|
||||
@code{(...)}.
|
||||
|
||||
The following statements are available: @code{ld}, @code{st},
|
||||
@code{while}.
|
||||
|
||||
The following functions are available:
|
||||
@table @var
|
||||
@item sinh(x)
|
||||
@item cosh(x)
|
||||
@item tanh(x)
|
||||
@item sin(x)
|
||||
@item cos(x)
|
||||
@item tan(x)
|
||||
@item atan(x)
|
||||
@item asin(x)
|
||||
@item acos(x)
|
||||
@item exp(x)
|
||||
@item log(x)
|
||||
@item abs(x)
|
||||
@item squish(x)
|
||||
@item gauss(x)
|
||||
@item mod(x, y)
|
||||
@item max(x, y)
|
||||
@item min(x, y)
|
||||
@item eq(x, y)
|
||||
@item gte(x, y)
|
||||
@item gt(x, y)
|
||||
@item lte(x, y)
|
||||
@item lt(x, y)
|
||||
@item bits2qp(bits)
|
||||
@item qp2bits(qp)
|
||||
@end table
|
||||
|
||||
The following constants are available:
|
||||
@table @var
|
||||
@item PI
|
||||
@item E
|
||||
@item iTex
|
||||
@item pTex
|
||||
@item tex
|
||||
@item mv
|
||||
@item fCode
|
||||
@item iCount
|
||||
@item mcVar
|
||||
@item var
|
||||
@item isI
|
||||
@item isP
|
||||
@item isB
|
||||
@item avgQP
|
||||
@item qComp
|
||||
@item avgIITex
|
||||
@item avgPITex
|
||||
@item avgPPTex
|
||||
@item avgBPTex
|
||||
@item avgTex
|
||||
@end table
|
||||
|
||||
@c man end
|
||||
|
||||
@ignore
|
||||
|
||||
@setfilename ffmpeg
|
||||
@settitle FFmpeg video converter
|
||||
|
||||
@c man begin SEEALSO
|
||||
ffserver(1), ffplay(1) and the HTML documentation of @file{ffmpeg}.
|
||||
@c man end
|
||||
|
||||
@c man begin AUTHOR
|
||||
Fabrice Bellard
|
||||
@c man end
|
||||
|
||||
@end ignore
|
||||
|
||||
@section Protocols
|
||||
|
||||
The file name can be @file{-} to read from standard input or to write
|
||||
to standard output.
|
||||
|
||||
FFmpeg also handles many protocols specified with an URL syntax.
|
||||
|
||||
Use 'ffmpeg -formats' to see a list of the supported protocols.
|
||||
|
||||
The protocol @code{http:} is currently used only to communicate with
|
||||
FFserver (see the FFserver documentation). When FFmpeg will be a
|
||||
video player it will also be used for streaming :-)
|
||||
|
||||
@chapter Tips
|
||||
|
||||
@itemize
|
||||
@item For streaming at very low bitrate application, use a low frame rate
|
||||
and a small GOP size. This is especially true for RealVideo where
|
||||
the Linux player does not seem to be very fast, so it can miss
|
||||
frames. An example is:
|
||||
|
||||
@example
|
||||
ffmpeg -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm
|
||||
@end example
|
||||
|
||||
@item The parameter 'q' which is displayed while encoding is the current
|
||||
quantizer. The value 1 indicates that a very good quality could
|
||||
be achieved. The value 31 indicates the worst quality. If q=31 appears
|
||||
too often, it means that the encoder cannot compress enough to meet
|
||||
your bitrate. You must either increase the bitrate, decrease the
|
||||
frame rate or decrease the frame size.
|
||||
|
||||
@item If your computer is not fast enough, you can speed up the
|
||||
compression at the expense of the compression ratio. You can use
|
||||
'-me zero' to speed up motion estimation, and '-intra' to disable
|
||||
motion estimation completely (you have only I-frames, which means it
|
||||
is about as good as JPEG compression).
|
||||
|
||||
@item To have very low audio bitrates, reduce the sampling frequency
|
||||
(down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3).
|
||||
|
||||
@item To have a constant quality (but a variable bitrate), use the option
|
||||
'-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
|
||||
quality).
|
||||
|
||||
@item When converting video files, you can use the '-sameq' option which
|
||||
uses the same quality factor in the encoder as in the decoder.
|
||||
It allows almost lossless encoding.
|
||||
|
||||
@end itemize
|
||||
|
||||
@bye
|
||||
@@ -1,172 +0,0 @@
|
||||
FFmpeg & evaluating performance on the PowerPC Architecture HOWTO
|
||||
|
||||
(c) 2003-2004 Romain Dolbeau <romain@dolbeau.org>
|
||||
|
||||
|
||||
|
||||
I - Introduction
|
||||
|
||||
The PowerPC architecture and its SIMD extension AltiVec offer some
|
||||
interesting tools to evaluate performance and improve the code.
|
||||
This document tries to explain how to use those tools with FFmpeg.
|
||||
|
||||
The architecture itself offers two ways to evaluate the performance of
|
||||
a given piece of code:
|
||||
|
||||
1) The Time Base Registers (TBL)
|
||||
2) The Performance Monitor Counter Registers (PMC)
|
||||
|
||||
The first ones are always available, always active, but they're not very
|
||||
accurate: the registers increment by one every four *bus* cycles. On
|
||||
my 667 Mhz tiBook (ppc7450), this means once every twenty *processor*
|
||||
cycles. So we won't use that.
|
||||
|
||||
The PMC are much more useful: not only can they report cycle-accurate
|
||||
timing, but they can also be used to monitor many other parameters,
|
||||
such as the number of AltiVec stalls for every kind of instruction,
|
||||
or instruction cache misses. The downside is that not all processors
|
||||
support the PMC (all G3, all G4 and the 970 do support them), and
|
||||
they're inactive by default - you need to activate them with a
|
||||
dedicated tool. Also, the number of available PMC depends on the
|
||||
procesor: the various 604 have 2, the various 75x (aka. G3) have 4,
|
||||
and the various 74xx (aka G4) have 6.
|
||||
|
||||
*WARNING*: The PowerPC 970 is not very well documented, and its PMC
|
||||
registers are 64 bits wide. To properly notify the code, you *must*
|
||||
tune for the 970 (using --tune=970), or the code will assume 32 bit
|
||||
registers.
|
||||
|
||||
|
||||
II - Enabling FFmpeg PowerPC performance support
|
||||
|
||||
This needs to be done by hand. First, you need to configure FFmpeg as
|
||||
usual, but add the "--powerpc-perf-enable" option. For instance:
|
||||
|
||||
#####
|
||||
./configure --prefix=/usr/local/ffmpeg-svn --cc=gcc-3.3 --tune=7450 --powerpc-perf-enable
|
||||
#####
|
||||
|
||||
This will configure FFmpeg to install inside /usr/local/ffmpeg-svn,
|
||||
compiling with gcc-3.3 (you should try to use this one or a newer
|
||||
gcc), and tuning for the PowerPC 7450 (i.e. the newer G4; as a rule of
|
||||
thumb, those at 550Mhz and more). It will also enable the PMC.
|
||||
|
||||
You may also edit the file "config.h" to enable the following line:
|
||||
|
||||
#####
|
||||
// #define ALTIVEC_USE_REFERENCE_C_CODE 1
|
||||
#####
|
||||
|
||||
If you enable this line, then the code will not make use of AltiVec,
|
||||
but will use the reference C code instead. This is useful to compare
|
||||
performance between two versions of the code.
|
||||
|
||||
Also, the number of enabled PMC is defined in "libavcodec/ppc/dsputil_ppc.h":
|
||||
|
||||
#####
|
||||
#define POWERPC_NUM_PMC_ENABLED 4
|
||||
#####
|
||||
|
||||
If you have a G4 CPU, you can enable all 6 PMC. DO NOT enable more
|
||||
PMC than available on your CPU!
|
||||
|
||||
Then, simply compile FFmpeg as usual (make && make install).
|
||||
|
||||
|
||||
|
||||
III - Using FFmpeg PowerPC performance support
|
||||
|
||||
This FFmeg can be used exactly as usual. But before exiting, FFmpeg
|
||||
will dump a per-function report that looks like this:
|
||||
|
||||
#####
|
||||
PowerPC performance report
|
||||
Values are from the PMC registers, and represent whatever the
|
||||
registers are set to record.
|
||||
Function "gmc1_altivec" (pmc1):
|
||||
min: 231
|
||||
max: 1339867
|
||||
avg: 558.25 (255302)
|
||||
Function "gmc1_altivec" (pmc2):
|
||||
min: 93
|
||||
max: 2164
|
||||
avg: 267.31 (255302)
|
||||
Function "gmc1_altivec" (pmc3):
|
||||
min: 72
|
||||
max: 1987
|
||||
avg: 276.20 (255302)
|
||||
(...)
|
||||
#####
|
||||
|
||||
In this example, PMC1 was set to record CPU cycles, PMC2 was set to
|
||||
record AltiVec Permute Stall Cycles, and PMC3 was set to record AltiVec
|
||||
Issue Stalls.
|
||||
|
||||
The function "gmc1_altivec" was monitored 255302 times, and the
|
||||
minimum execution time was 231 processor cycles. The max and average
|
||||
aren't much use, as it's very likely the OS interrupted execution for
|
||||
reasons of its own :-(
|
||||
|
||||
With the exact same settings and source file, but using the reference C
|
||||
code we get:
|
||||
|
||||
#####
|
||||
PowerPC performance report
|
||||
Values are from the PMC registers, and represent whatever the
|
||||
registers are set to record.
|
||||
Function "gmc1_altivec" (pmc1):
|
||||
min: 592
|
||||
max: 2532235
|
||||
avg: 962.88 (255302)
|
||||
Function "gmc1_altivec" (pmc2):
|
||||
min: 0
|
||||
max: 33
|
||||
avg: 0.00 (255302)
|
||||
Function "gmc1_altivec" (pmc3):
|
||||
min: 0
|
||||
max: 350
|
||||
avg: 0.03 (255302)
|
||||
(...)
|
||||
#####
|
||||
|
||||
592 cycles, so the fastest AltiVec execution is about 2.5x faster than
|
||||
the fastest C execution in this example. It's not perfect but it's not
|
||||
bad (well I wrote this function so I can't say otherwise :-).
|
||||
|
||||
Once you have that kind of report, you can try to improve things by
|
||||
finding what goes wrong and fixing it; in the example above, one
|
||||
should try to diminish the number of AltiVec stalls, as this *may*
|
||||
improve performance.
|
||||
|
||||
|
||||
|
||||
IV) Enabling the PMC in Mac OS X
|
||||
|
||||
This is easy. Use "Monster" and "monster". Those tools come from
|
||||
Apple's CHUD package, and can be found hidden in the developer web
|
||||
site & FTP site. "MONster" is the graphical application, use it to
|
||||
generate a config file specifying what each register should
|
||||
monitor. Then use the command-line application "monster" to use that
|
||||
config file, and enjoy the results.
|
||||
|
||||
Note that "MONster" can be used for many other things, but it's
|
||||
documented by Apple, it's not my subject.
|
||||
|
||||
If you are using CHUD 4.4.2 or later, you'll notice that MONster is
|
||||
no longer available. It's been superseeded by Shark, where
|
||||
configuration of PMCs is available as a plugin.
|
||||
|
||||
|
||||
|
||||
V) Enabling the PMC on Linux
|
||||
|
||||
On linux you may use oprofile from http://oprofile.sf.net, depending on the
|
||||
version and the cpu you may need to apply a patch[1] to access a set of the
|
||||
possibile counters from the userspace application. You can always define them
|
||||
using the kernel interface /dev/oprofile/* .
|
||||
|
||||
[1] http://dev.gentoo.org/~lu_zero/development/oprofile-g4-20060423.patch
|
||||
|
||||
--
|
||||
Romain Dolbeau <romain@dolbeau.org>
|
||||
Luca Barbato <lu_zero@gentoo.org>
|
||||
@@ -1,159 +0,0 @@
|
||||
\input texinfo @c -*- texinfo -*-
|
||||
|
||||
@settitle FFplay Documentation
|
||||
@titlepage
|
||||
@sp 7
|
||||
@center @titlefont{FFplay Documentation}
|
||||
@sp 3
|
||||
@end titlepage
|
||||
|
||||
|
||||
@chapter Introduction
|
||||
|
||||
@c man begin DESCRIPTION
|
||||
FFplay is a very simple and portable media player using the FFmpeg
|
||||
libraries and the SDL library. It is mostly used as a testbed for the
|
||||
various FFmpeg APIs.
|
||||
@c man end
|
||||
|
||||
@chapter Invocation
|
||||
|
||||
@section Syntax
|
||||
@example
|
||||
@c man begin SYNOPSIS
|
||||
ffplay [options] @file{input_file}
|
||||
@c man end
|
||||
@end example
|
||||
|
||||
@c man begin OPTIONS
|
||||
@section Main options
|
||||
|
||||
@table @option
|
||||
@item -h
|
||||
Show help.
|
||||
@item -version
|
||||
Show version.
|
||||
@item -L
|
||||
Show license.
|
||||
@item -formats
|
||||
Show available formats, codecs, protocols, ...
|
||||
@item -x @var{width}
|
||||
Force displayed width.
|
||||
@item -y @var{height}
|
||||
Force displayed height.
|
||||
@item -s @var{size}
|
||||
Set frame size (WxH or abbreviation), needed for videos which don't
|
||||
contain a header with the frame size like raw YUV.
|
||||
@item -an
|
||||
Disable audio.
|
||||
@item -vn
|
||||
Disable video.
|
||||
@item -ss @var{pos}
|
||||
Seek to a given position in seconds.
|
||||
@item -bytes
|
||||
Seek by bytes.
|
||||
@item -nodisp
|
||||
Disable graphical display.
|
||||
@item -f @var{fmt}
|
||||
Force format.
|
||||
@end table
|
||||
|
||||
@section Advanced options
|
||||
@table @option
|
||||
@item -pix_fmt @var{format}
|
||||
Set pixel format.
|
||||
@item -stats
|
||||
Show the stream duration, the codec parameters, the current position in
|
||||
the stream and the audio/video synchronisation drift.
|
||||
@item -debug
|
||||
Print specific debug info.
|
||||
@item -bug
|
||||
Work around bugs.
|
||||
@item -vismv
|
||||
Visualize motion vectors.
|
||||
@item -fast
|
||||
Non-spec-compliant optimizations.
|
||||
@item -genpts
|
||||
Generate pts.
|
||||
@item -rtp_tcp
|
||||
Force RTP/TCP protocol usage instead of RTP/UDP. It is only meaningful
|
||||
if you are streaming with the RTSP protocol.
|
||||
@item -sync @var{type}
|
||||
Set the master clock to audio (@code{type=audio}), video
|
||||
(@code{type=video}) or external (@code{type=ext}). Default is audio. The
|
||||
master clock is used to control audio-video synchronization. Most media
|
||||
players use audio as master clock, but in some cases (streaming or high
|
||||
quality broadcast) it is necessary to change that. This option is mainly
|
||||
used for debugging purposes.
|
||||
@item -threads @var{count}
|
||||
Set the thread count.
|
||||
@item -ast @var{audio_stream_number}
|
||||
Select the desired audio stream number, counting from 0. The number
|
||||
refers to the list of all the input audio streams. If it is greater
|
||||
than the number of audio streams minus one, then the last one is
|
||||
selected, if it is negative the audio playback is disabled.
|
||||
@item -vst @var{video_stream_number}
|
||||
Select the desired video stream number, counting from 0. The number
|
||||
refers to the list of all the input video streams. If it is greater
|
||||
than the number of video streams minus one, then the last one is
|
||||
selected, if it is negative the video playback is disabled.
|
||||
@item -sst @var{subtitle_stream_number}
|
||||
Select the desired subtitle stream number, counting from 0. The number
|
||||
refers to the list of all the input subtitle streams. If it is greater
|
||||
than the number of subtitle streams minus one, then the last one is
|
||||
selected, if it is negative the subtitle rendering is disabled.
|
||||
@end table
|
||||
|
||||
@section While playing
|
||||
|
||||
@table @key
|
||||
@item q, ESC
|
||||
Quit.
|
||||
|
||||
@item f
|
||||
Toggle full screen.
|
||||
|
||||
@item p, SPC
|
||||
Pause.
|
||||
|
||||
@item a
|
||||
Cycle audio channel.
|
||||
|
||||
@item v
|
||||
Cycle video channel.
|
||||
|
||||
@item t
|
||||
Cycle subtitle channel.
|
||||
|
||||
@item w
|
||||
Show audio waves.
|
||||
|
||||
@item left/right
|
||||
Seek backward/forward 10 seconds.
|
||||
|
||||
@item down/up
|
||||
Seek backward/forward 1 minute.
|
||||
|
||||
@item mouse click
|
||||
Seek to percentage in file corresponding to fraction of width.
|
||||
|
||||
@end table
|
||||
|
||||
@c man end
|
||||
|
||||
@ignore
|
||||
|
||||
@setfilename ffplay
|
||||
@settitle FFplay media player
|
||||
|
||||
@c man begin SEEALSO
|
||||
ffmpeg(1), ffserver(1) and the HTML documentation of @file{ffmpeg}.
|
||||
@c man end
|
||||
|
||||
@c man begin AUTHOR
|
||||
Fabrice Bellard
|
||||
@c man end
|
||||
|
||||
@end ignore
|
||||
|
||||
@bye
|
||||
@@ -1,277 +0,0 @@
|
||||
\input texinfo @c -*- texinfo -*-
|
||||
|
||||
@settitle FFserver Documentation
|
||||
@titlepage
|
||||
@sp 7
|
||||
@center @titlefont{FFserver Documentation}
|
||||
@sp 3
|
||||
@end titlepage
|
||||
|
||||
|
||||
@chapter Introduction
|
||||
|
||||
@c man begin DESCRIPTION
|
||||
FFserver is a streaming server for both audio and video. It supports
|
||||
several live feeds, streaming from files and time shifting on live feeds
|
||||
(you can seek to positions in the past on each live feed, provided you
|
||||
specify a big enough feed storage in ffserver.conf).
|
||||
|
||||
FFserver runs in daemon mode by default; that is, it puts itself in
|
||||
the background and detaches from its TTY, unless it is launched in
|
||||
debug mode or a NoDaemon option is specified in the configuration
|
||||
file.
|
||||
|
||||
This documentation covers only the streaming aspects of ffserver /
|
||||
ffmpeg. All questions about parameters for ffmpeg, codec questions,
|
||||
etc. are not covered here. Read @file{ffmpeg-doc.html} for more
|
||||
information.
|
||||
|
||||
@section How does it work?
|
||||
|
||||
FFserver receives prerecorded files or FFM streams from some ffmpeg
|
||||
instance as input, then streams them over RTP/RTSP/HTTP.
|
||||
|
||||
An ffserver instance will listen on some port as specified in the
|
||||
configuration file. You can launch one or more instances of ffmpeg and
|
||||
send one or more FFM streams to the port where ffserver is expecting
|
||||
to receive them. Alternately, you can make ffserver launch such ffmpeg
|
||||
instances at startup.
|
||||
|
||||
Input streams are called feeds, and each one is specified by a <Feed>
|
||||
section in the configuration file.
|
||||
|
||||
For each feed you can have different output streams in various
|
||||
formats, each one specified by a <Stream> section in the configuration
|
||||
file.
|
||||
|
||||
@section Status stream
|
||||
|
||||
FFserver supports an HTTP interface which exposes the current status
|
||||
of the server.
|
||||
|
||||
Simply point your browser to the address of the special status stream
|
||||
specified in the configuration file.
|
||||
|
||||
For example if you have:
|
||||
@example
|
||||
<Stream status.html>
|
||||
Format status
|
||||
|
||||
# Only allow local people to get the status
|
||||
ACL allow localhost
|
||||
ACL allow 192.168.0.0 192.168.255.255
|
||||
</Stream>
|
||||
@end example
|
||||
|
||||
then the server will post a page with the status information when
|
||||
the special stream @file{status.html} is requested.
|
||||
|
||||
@section What can this do?
|
||||
|
||||
When properly configured and running, you can capture video and audio in real
|
||||
time from a suitable capture card, and stream it out over the Internet to
|
||||
either Windows Media Player or RealAudio player (with some restrictions).
|
||||
|
||||
It can also stream from files, though that is currently broken. Very often, a
|
||||
web server can be used to serve up the files just as well.
|
||||
|
||||
It can stream prerecorded video from .ffm files, though it is somewhat tricky
|
||||
to make it work correctly.
|
||||
|
||||
@section What do I need?
|
||||
|
||||
I use Linux on a 900 MHz Duron with a cheapo Bt848 based TV capture card. I'm
|
||||
using stock Linux 2.4.17 with the stock drivers. [Actually that isn't true,
|
||||
I needed some special drivers for my motherboard-based sound card.]
|
||||
|
||||
I understand that FreeBSD systems work just fine as well.
|
||||
|
||||
@section How do I make it work?
|
||||
|
||||
First, build the kit. It *really* helps to have installed LAME first. Then when
|
||||
you run the ffserver ./configure, make sure that you have the
|
||||
@code{--enable-libmp3lame} flag turned on.
|
||||
|
||||
LAME is important as it allows for streaming audio to Windows Media Player.
|
||||
Don't ask why the other audio types do not work.
|
||||
|
||||
As a simple test, just run the following two command lines where INPUTFILE
|
||||
is some file which you can decode with ffmpeg:
|
||||
|
||||
@example
|
||||
./ffserver -f doc/ffserver.conf &
|
||||
./ffmpeg -i INPUTFILE http://localhost:8090/feed1.ffm
|
||||
@end example
|
||||
|
||||
At this point you should be able to go to your Windows machine and fire up
|
||||
Windows Media Player (WMP). Go to Open URL and enter
|
||||
|
||||
@example
|
||||
http://<linuxbox>:8090/test.asf
|
||||
@end example
|
||||
|
||||
You should (after a short delay) see video and hear audio.
|
||||
|
||||
WARNING: trying to stream test1.mpg doesn't work with WMP as it tries to
|
||||
transfer the entire file before starting to play.
|
||||
The same is true of AVI files.
|
||||
|
||||
@section What happens next?
|
||||
|
||||
You should edit the ffserver.conf file to suit your needs (in terms of
|
||||
frame rates etc). Then install ffserver and ffmpeg, write a script to start
|
||||
them up, and off you go.
|
||||
|
||||
@section Troubleshooting
|
||||
|
||||
@subsection I don't hear any audio, but video is fine.
|
||||
|
||||
Maybe you didn't install LAME, or got your ./configure statement wrong. Check
|
||||
the ffmpeg output to see if a line referring to MP3 is present. If not, then
|
||||
your configuration was incorrect. If it is, then maybe your wiring is not
|
||||
set up correctly. Maybe the sound card is not getting data from the right
|
||||
input source. Maybe you have a really awful audio interface (like I do)
|
||||
that only captures in stereo and also requires that one channel be flipped.
|
||||
If you are one of these people, then export 'AUDIO_FLIP_LEFT=1' before
|
||||
starting ffmpeg.
|
||||
|
||||
@subsection The audio and video loose sync after a while.
|
||||
|
||||
Yes, they do.
|
||||
|
||||
@subsection After a long while, the video update rate goes way down in WMP.
|
||||
|
||||
Yes, it does. Who knows why?
|
||||
|
||||
@subsection WMP 6.4 behaves differently to WMP 7.
|
||||
|
||||
Yes, it does. Any thoughts on this would be gratefully received. These
|
||||
differences extend to embedding WMP into a web page. [There are two
|
||||
object IDs that you can use: The old one, which does not play well, and
|
||||
the new one, which does (both tested on the same system). However,
|
||||
I suspect that the new one is not available unless you have installed WMP 7].
|
||||
|
||||
@section What else can it do?
|
||||
|
||||
You can replay video from .ffm files that was recorded earlier.
|
||||
However, there are a number of caveats, including the fact that the
|
||||
ffserver parameters must match the original parameters used to record the
|
||||
file. If they do not, then ffserver deletes the file before recording into it.
|
||||
(Now that I write this, it seems broken).
|
||||
|
||||
You can fiddle with many of the codec choices and encoding parameters, and
|
||||
there are a bunch more parameters that you cannot control. Post a message
|
||||
to the mailing list if there are some 'must have' parameters. Look in
|
||||
ffserver.conf for a list of the currently available controls.
|
||||
|
||||
It will automatically generate the ASX or RAM files that are often used
|
||||
in browsers. These files are actually redirections to the underlying ASF
|
||||
or RM file. The reason for this is that the browser often fetches the
|
||||
entire file before starting up the external viewer. The redirection files
|
||||
are very small and can be transferred quickly. [The stream itself is
|
||||
often 'infinite' and thus the browser tries to download it and never
|
||||
finishes.]
|
||||
|
||||
@section Tips
|
||||
|
||||
* When you connect to a live stream, most players (WMP, RA, etc) want to
|
||||
buffer a certain number of seconds of material so that they can display the
|
||||
signal continuously. However, ffserver (by default) starts sending data
|
||||
in realtime. This means that there is a pause of a few seconds while the
|
||||
buffering is being done by the player. The good news is that this can be
|
||||
cured by adding a '?buffer=5' to the end of the URL. This means that the
|
||||
stream should start 5 seconds in the past -- and so the first 5 seconds
|
||||
of the stream are sent as fast as the network will allow. It will then
|
||||
slow down to real time. This noticeably improves the startup experience.
|
||||
|
||||
You can also add a 'Preroll 15' statement into the ffserver.conf that will
|
||||
add the 15 second prebuffering on all requests that do not otherwise
|
||||
specify a time. In addition, ffserver will skip frames until a key_frame
|
||||
is found. This further reduces the startup delay by not transferring data
|
||||
that will be discarded.
|
||||
|
||||
* You may want to adjust the MaxBandwidth in the ffserver.conf to limit
|
||||
the amount of bandwidth consumed by live streams.
|
||||
|
||||
@section Why does the ?buffer / Preroll stop working after a time?
|
||||
|
||||
It turns out that (on my machine at least) the number of frames successfully
|
||||
grabbed is marginally less than the number that ought to be grabbed. This
|
||||
means that the timestamp in the encoded data stream gets behind realtime.
|
||||
This means that if you say 'Preroll 10', then when the stream gets 10
|
||||
or more seconds behind, there is no Preroll left.
|
||||
|
||||
Fixing this requires a change in the internals of how timestamps are
|
||||
handled.
|
||||
|
||||
@section Does the @code{?date=} stuff work.
|
||||
|
||||
Yes (subject to the limitation outlined above). Also note that whenever you
|
||||
start ffserver, it deletes the ffm file (if any parameters have changed),
|
||||
thus wiping out what you had recorded before.
|
||||
|
||||
The format of the @code{?date=xxxxxx} is fairly flexible. You should use one
|
||||
of the following formats (the 'T' is literal):
|
||||
|
||||
@example
|
||||
* YYYY-MM-DDTHH:MM:SS (localtime)
|
||||
* YYYY-MM-DDTHH:MM:SSZ (UTC)
|
||||
@end example
|
||||
|
||||
You can omit the YYYY-MM-DD, and then it refers to the current day. However
|
||||
note that @samp{?date=16:00:00} refers to 16:00 on the current day -- this
|
||||
may be in the future and so is unlikely to be useful.
|
||||
|
||||
You use this by adding the ?date= to the end of the URL for the stream.
|
||||
For example: @samp{http://localhost:8080/test.asf?date=2002-07-26T23:05:00}.
|
||||
@c man end
|
||||
|
||||
@chapter Invocation
|
||||
@section Syntax
|
||||
@example
|
||||
@c man begin SYNOPSIS
|
||||
ffserver [options]
|
||||
@c man end
|
||||
@end example
|
||||
|
||||
@section Options
|
||||
@c man begin OPTIONS
|
||||
@table @option
|
||||
@item -version
|
||||
Show version.
|
||||
@item -L
|
||||
Show license.
|
||||
@item -formats
|
||||
Show available formats, codecs, protocols, ...
|
||||
@item -h
|
||||
Show help.
|
||||
@item -f @var{configfile}
|
||||
Use @file{configfile} instead of @file{/etc/ffserver.conf}.
|
||||
@item -n
|
||||
Enable no-launch mode. This option disables all the Launch directives
|
||||
within the various <Stream> sections. FFserver will not launch any
|
||||
ffmpeg instance, so you will have to launch them manually.
|
||||
@item -d
|
||||
Enable debug mode. This option increases log verbosity, directs log
|
||||
messages to stdout and causes ffserver to run in the foreground
|
||||
rather than as a daemon.
|
||||
@end table
|
||||
@c man end
|
||||
|
||||
@ignore
|
||||
|
||||
@setfilename ffserver
|
||||
@settitle FFserver video server
|
||||
|
||||
@c man begin SEEALSO
|
||||
ffmpeg(1), ffplay(1), the @file{ffmpeg/doc/ffserver.conf} example and
|
||||
the HTML documentation of @file{ffmpeg}.
|
||||
@c man end
|
||||
|
||||
@c man begin AUTHOR
|
||||
Fabrice Bellard
|
||||
@c man end
|
||||
|
||||
@end ignore
|
||||
|
||||
@bye
|
||||
@@ -1,356 +0,0 @@
|
||||
# Port on which the server is listening. You must select a different
|
||||
# port from your standard HTTP web server if it is running on the same
|
||||
# computer.
|
||||
Port 8090
|
||||
|
||||
# Address on which the server is bound. Only useful if you have
|
||||
# several network interfaces.
|
||||
BindAddress 0.0.0.0
|
||||
|
||||
# Number of simultaneous HTTP connections that can be handled. It has
|
||||
# to be defined *before* the MaxClients parameter, since it defines the
|
||||
# MaxClients maximum limit.
|
||||
MaxHTTPConnections 2000
|
||||
|
||||
# Number of simultaneous requests that can be handled. Since FFServer
|
||||
# is very fast, it is more likely that you will want to leave this high
|
||||
# and use MaxBandwidth, below.
|
||||
MaxClients 1000
|
||||
|
||||
# This the maximum amount of kbit/sec that you are prepared to
|
||||
# consume when streaming to clients.
|
||||
MaxBandwidth 1000
|
||||
|
||||
# Access log file (uses standard Apache log file format)
|
||||
# '-' is the standard output.
|
||||
CustomLog -
|
||||
|
||||
# Suppress that if you want to launch ffserver as a daemon.
|
||||
NoDaemon
|
||||
|
||||
|
||||
##################################################################
|
||||
# Definition of the live feeds. Each live feed contains one video
|
||||
# and/or audio sequence coming from an ffmpeg encoder or another
|
||||
# ffserver. This sequence may be encoded simultaneously with several
|
||||
# codecs at several resolutions.
|
||||
|
||||
<Feed feed1.ffm>
|
||||
|
||||
# You must use 'ffmpeg' to send a live feed to ffserver. In this
|
||||
# example, you can type:
|
||||
#
|
||||
# ffmpeg http://localhost:8090/feed1.ffm
|
||||
|
||||
# ffserver can also do time shifting. It means that it can stream any
|
||||
# previously recorded live stream. The request should contain:
|
||||
# "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify
|
||||
# a path where the feed is stored on disk. You also specify the
|
||||
# maximum size of the feed, where zero means unlimited. Default:
|
||||
# File=/tmp/feed_name.ffm FileMaxSize=5M
|
||||
File /tmp/feed1.ffm
|
||||
FileMaxSize 200K
|
||||
|
||||
# You could specify
|
||||
# ReadOnlyFile /saved/specialvideo.ffm
|
||||
# This marks the file as readonly and it will not be deleted or updated.
|
||||
|
||||
# Specify launch in order to start ffmpeg automatically.
|
||||
# First ffmpeg must be defined with an appropriate path if needed,
|
||||
# after that options can follow, but avoid adding the http:// field
|
||||
#Launch ffmpeg
|
||||
|
||||
# Only allow connections from localhost to the feed.
|
||||
ACL allow 127.0.0.1
|
||||
|
||||
</Feed>
|
||||
|
||||
|
||||
##################################################################
|
||||
# Now you can define each stream which will be generated from the
|
||||
# original audio and video stream. Each format has a filename (here
|
||||
# 'test1.mpg'). FFServer will send this stream when answering a
|
||||
# request containing this filename.
|
||||
|
||||
<Stream test1.mpg>
|
||||
|
||||
# coming from live feed 'feed1'
|
||||
Feed feed1.ffm
|
||||
|
||||
# Format of the stream : you can choose among:
|
||||
# mpeg : MPEG-1 multiplexed video and audio
|
||||
# mpegvideo : only MPEG-1 video
|
||||
# mp2 : MPEG-2 audio (use AudioCodec to select layer 2 and 3 codec)
|
||||
# ogg : Ogg format (Vorbis audio codec)
|
||||
# rm : RealNetworks-compatible stream. Multiplexed audio and video.
|
||||
# ra : RealNetworks-compatible stream. Audio only.
|
||||
# mpjpeg : Multipart JPEG (works with Netscape without any plugin)
|
||||
# jpeg : Generate a single JPEG image.
|
||||
# asf : ASF compatible streaming (Windows Media Player format).
|
||||
# swf : Macromedia Flash compatible stream
|
||||
# avi : AVI format (MPEG-4 video, MPEG audio sound)
|
||||
Format mpeg
|
||||
|
||||
# Bitrate for the audio stream. Codecs usually support only a few
|
||||
# different bitrates.
|
||||
AudioBitRate 32
|
||||
|
||||
# Number of audio channels: 1 = mono, 2 = stereo
|
||||
AudioChannels 1
|
||||
|
||||
# Sampling frequency for audio. When using low bitrates, you should
|
||||
# lower this frequency to 22050 or 11025. The supported frequencies
|
||||
# depend on the selected audio codec.
|
||||
AudioSampleRate 44100
|
||||
|
||||
# Bitrate for the video stream
|
||||
VideoBitRate 64
|
||||
|
||||
# Ratecontrol buffer size
|
||||
VideoBufferSize 40
|
||||
|
||||
# Number of frames per second
|
||||
VideoFrameRate 3
|
||||
|
||||
# Size of the video frame: WxH (default: 160x128)
|
||||
# The following abbreviations are defined: sqcif, qcif, cif, 4cif, qqvga,
|
||||
# qvga, vga, svga, xga, uxga, qxga, sxga, qsxga, hsxga, wvga, wxga, wsxga,
|
||||
# wuxga, woxga, wqsxga, wquxga, whsxga, whuxga, cga, ega, hd480, hd720,
|
||||
# hd1080
|
||||
VideoSize 160x128
|
||||
|
||||
# Transmit only intra frames (useful for low bitrates, but kills frame rate).
|
||||
#VideoIntraOnly
|
||||
|
||||
# If non-intra only, an intra frame is transmitted every VideoGopSize
|
||||
# frames. Video synchronization can only begin at an intra frame.
|
||||
VideoGopSize 12
|
||||
|
||||
# More MPEG-4 parameters
|
||||
# VideoHighQuality
|
||||
# Video4MotionVector
|
||||
|
||||
# Choose your codecs:
|
||||
#AudioCodec mp2
|
||||
#VideoCodec mpeg1video
|
||||
|
||||
# Suppress audio
|
||||
#NoAudio
|
||||
|
||||
# Suppress video
|
||||
#NoVideo
|
||||
|
||||
#VideoQMin 3
|
||||
#VideoQMax 31
|
||||
|
||||
# Set this to the number of seconds backwards in time to start. Note that
|
||||
# most players will buffer 5-10 seconds of video, and also you need to allow
|
||||
# for a keyframe to appear in the data stream.
|
||||
#Preroll 15
|
||||
|
||||
# ACL:
|
||||
|
||||
# You can allow ranges of addresses (or single addresses)
|
||||
#ACL ALLOW <first address> <last address>
|
||||
|
||||
# You can deny ranges of addresses (or single addresses)
|
||||
#ACL DENY <first address> <last address>
|
||||
|
||||
# You can repeat the ACL allow/deny as often as you like. It is on a per
|
||||
# stream basis. The first match defines the action. If there are no matches,
|
||||
# then the default is the inverse of the last ACL statement.
|
||||
#
|
||||
# Thus 'ACL allow localhost' only allows access from localhost.
|
||||
# 'ACL deny 1.0.0.0 1.255.255.255' would deny the whole of network 1 and
|
||||
# allow everybody else.
|
||||
|
||||
</Stream>
|
||||
|
||||
|
||||
##################################################################
|
||||
# Example streams
|
||||
|
||||
|
||||
# Multipart JPEG
|
||||
|
||||
#<Stream test.mjpg>
|
||||
#Feed feed1.ffm
|
||||
#Format mpjpeg
|
||||
#VideoFrameRate 2
|
||||
#VideoIntraOnly
|
||||
#NoAudio
|
||||
#Strict -1
|
||||
#</Stream>
|
||||
|
||||
|
||||
# Single JPEG
|
||||
|
||||
#<Stream test.jpg>
|
||||
#Feed feed1.ffm
|
||||
#Format jpeg
|
||||
#VideoFrameRate 2
|
||||
#VideoIntraOnly
|
||||
##VideoSize 352x240
|
||||
#NoAudio
|
||||
#Strict -1
|
||||
#</Stream>
|
||||
|
||||
|
||||
# Flash
|
||||
|
||||
#<Stream test.swf>
|
||||
#Feed feed1.ffm
|
||||
#Format swf
|
||||
#VideoFrameRate 2
|
||||
#VideoIntraOnly
|
||||
#NoAudio
|
||||
#</Stream>
|
||||
|
||||
|
||||
# ASF compatible
|
||||
|
||||
<Stream test.asf>
|
||||
Feed feed1.ffm
|
||||
Format asf
|
||||
VideoFrameRate 15
|
||||
VideoSize 352x240
|
||||
VideoBitRate 256
|
||||
VideoBufferSize 40
|
||||
VideoGopSize 30
|
||||
AudioBitRate 64
|
||||
StartSendOnKey
|
||||
</Stream>
|
||||
|
||||
|
||||
# MP3 audio
|
||||
|
||||
#<Stream test.mp3>
|
||||
#Feed feed1.ffm
|
||||
#Format mp2
|
||||
#AudioCodec mp3
|
||||
#AudioBitRate 64
|
||||
#AudioChannels 1
|
||||
#AudioSampleRate 44100
|
||||
#NoVideo
|
||||
#</Stream>
|
||||
|
||||
|
||||
# Ogg Vorbis audio
|
||||
|
||||
#<Stream test.ogg>
|
||||
#Feed feed1.ffm
|
||||
#Title "Stream title"
|
||||
#AudioBitRate 64
|
||||
#AudioChannels 2
|
||||
#AudioSampleRate 44100
|
||||
#NoVideo
|
||||
#</Stream>
|
||||
|
||||
|
||||
# Real with audio only at 32 kbits
|
||||
|
||||
#<Stream test.ra>
|
||||
#Feed feed1.ffm
|
||||
#Format rm
|
||||
#AudioBitRate 32
|
||||
#NoVideo
|
||||
#NoAudio
|
||||
#</Stream>
|
||||
|
||||
|
||||
# Real with audio and video at 64 kbits
|
||||
|
||||
#<Stream test.rm>
|
||||
#Feed feed1.ffm
|
||||
#Format rm
|
||||
#AudioBitRate 32
|
||||
#VideoBitRate 128
|
||||
#VideoFrameRate 25
|
||||
#VideoGopSize 25
|
||||
#NoAudio
|
||||
#</Stream>
|
||||
|
||||
|
||||
##################################################################
|
||||
# A stream coming from a file: you only need to set the input
|
||||
# filename and optionally a new format. Supported conversions:
|
||||
# AVI -> ASF
|
||||
|
||||
#<Stream file.rm>
|
||||
#File "/usr/local/httpd/htdocs/tlive.rm"
|
||||
#NoAudio
|
||||
#</Stream>
|
||||
|
||||
#<Stream file.asf>
|
||||
#File "/usr/local/httpd/htdocs/test.asf"
|
||||
#NoAudio
|
||||
#Author "Me"
|
||||
#Copyright "Super MegaCorp"
|
||||
#Title "Test stream from disk"
|
||||
#Comment "Test comment"
|
||||
#</Stream>
|
||||
|
||||
|
||||
##################################################################
|
||||
# RTSP examples
|
||||
#
|
||||
# You can access this stream with the RTSP URL:
|
||||
# rtsp://localhost:5454/test1-rtsp.mpg
|
||||
#
|
||||
# A non-standard RTSP redirector is also created. Its URL is:
|
||||
# http://localhost:8090/test1-rtsp.rtsp
|
||||
|
||||
#<Stream test1-rtsp.mpg>
|
||||
#Format rtp
|
||||
#File "/usr/local/httpd/htdocs/test1.mpg"
|
||||
#</Stream>
|
||||
|
||||
|
||||
##################################################################
|
||||
# SDP/multicast examples
|
||||
#
|
||||
# If you want to send your stream in multicast, you must set the
|
||||
# multicast address with MulticastAddress. The port and the TTL can
|
||||
# also be set.
|
||||
#
|
||||
# An SDP file is automatically generated by ffserver by adding the
|
||||
# 'sdp' extension to the stream name (here
|
||||
# http://localhost:8090/test1-sdp.sdp). You should usually give this
|
||||
# file to your player to play the stream.
|
||||
#
|
||||
# The 'NoLoop' option can be used to avoid looping when the stream is
|
||||
# terminated.
|
||||
|
||||
#<Stream test1-sdp.mpg>
|
||||
#Format rtp
|
||||
#File "/usr/local/httpd/htdocs/test1.mpg"
|
||||
#MulticastAddress 224.124.0.1
|
||||
#MulticastPort 5000
|
||||
#MulticastTTL 16
|
||||
#NoLoop
|
||||
#</Stream>
|
||||
|
||||
|
||||
##################################################################
|
||||
# Special streams
|
||||
|
||||
# Server status
|
||||
|
||||
<Stream stat.html>
|
||||
Format status
|
||||
|
||||
# Only allow local people to get the status
|
||||
ACL allow localhost
|
||||
ACL allow 192.168.0.0 192.168.255.255
|
||||
|
||||
#FaviconURL http://pond1.gladstonefamily.net:8080/favicon.ico
|
||||
</Stream>
|
||||
|
||||
|
||||
# Redirect index.html to the appropriate site
|
||||
|
||||
<Redirect index.html>
|
||||
URL http://www.ffmpeg.org/
|
||||
</Redirect>
|
||||
|
||||
|
||||
-1364
File diff suppressed because it is too large
Load Diff
-299
@@ -1,299 +0,0 @@
|
||||
\input texinfo @c -*- texinfo -*-
|
||||
|
||||
@settitle Video Hook Documentation
|
||||
@titlepage
|
||||
@sp 7
|
||||
@center @titlefont{Video Hook Documentation}
|
||||
@sp 3
|
||||
@end titlepage
|
||||
|
||||
|
||||
@chapter Introduction
|
||||
|
||||
@var{Please be aware that vhook is deprecated, and hence its development is
|
||||
frozen (bug fixes are still accepted).
|
||||
The substitute will be 'libavfilter', the result of our 'Video Filter API'
|
||||
Google Summer of Code project. You may monitor its progress by subscribing to
|
||||
the ffmpeg-soc mailing list at
|
||||
@url{http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc}.}
|
||||
|
||||
The video hook functionality is designed (mostly) for live video. It allows
|
||||
the video to be modified or examined between the decoder and the encoder.
|
||||
|
||||
Any number of hook modules can be placed inline, and they are run in the
|
||||
order that they were specified on the ffmpeg command line.
|
||||
|
||||
The video hook modules are provided for use as a base for your own modules,
|
||||
and are described below.
|
||||
|
||||
Modules are loaded using the -vhook option to ffmpeg. The value of this parameter
|
||||
is a space separated list of arguments. The first is the module name, and the rest
|
||||
are passed as arguments to the Configure function of the module.
|
||||
|
||||
The modules are dynamic libraries: They have different suffixes (.so, .dll, .dylib)
|
||||
depending on your platform. And your platform dictates if they need to be
|
||||
somewhere in your PATH, or in your LD_LIBRARY_PATH. Otherwise you will need to
|
||||
specify the full path of the vhook file that you are using.
|
||||
|
||||
@section null.c
|
||||
|
||||
This does nothing. Actually it converts the input image to RGB24 and then converts
|
||||
it back again. This is meant as a sample that you can use to test your setup.
|
||||
|
||||
@section fish.c
|
||||
|
||||
This implements a 'fish detector'. Essentially it converts the image into HSV
|
||||
space and tests whether more than a certain percentage of the pixels fall into
|
||||
a specific HSV cuboid. If so, then the image is saved into a file for processing
|
||||
by other bits of code.
|
||||
|
||||
Why use HSV? It turns out that HSV cuboids represent a more compact range of
|
||||
colors than would an RGB cuboid.
|
||||
|
||||
@section imlib2.c
|
||||
|
||||
This module implements a text overlay for a video image. Currently it
|
||||
supports a fixed overlay or reading the text from a file. The string
|
||||
is passed through strftime() so that it is easy to imprint the date and
|
||||
time onto the image.
|
||||
|
||||
This module depends on the external library imlib2, available on
|
||||
Sourceforge, among other places, if it is not already installed on
|
||||
your system.
|
||||
|
||||
You may also overlay an image (even semi-transparent) like TV stations do.
|
||||
You may move either the text or the image around your video to create
|
||||
scrolling credits, for example.
|
||||
|
||||
The font file used is looked for in a FONTPATH environment variable, and
|
||||
prepended to the point size as a command line option and can be specified
|
||||
with the full path to the font file, as in:
|
||||
@example
|
||||
-F /usr/X11R6/lib/X11/fonts/TTF/VeraBd.ttf/20
|
||||
@end example
|
||||
where 20 is the point size.
|
||||
|
||||
You can specify the filename to read RGB color names from. If it is not
|
||||
specified, these defaults are used: @file{/usr/share/X11/rgb.txt} and
|
||||
@file{/usr/lib/X11/rgb.txt}
|
||||
|
||||
Options:
|
||||
@multitable @columnfractions .2 .8
|
||||
@item @option{-C <rgb.txt>} @tab The filename to read RGB color names from
|
||||
@item @option{-c <color>} @tab The color of the text
|
||||
@item @option{-F <fontname>} @tab The font face and size
|
||||
@item @option{-t <text>} @tab The text
|
||||
@item @option{-f <filename>} @tab The filename to read text from
|
||||
@item @option{-x <expression>}@tab x coordinate of text or image
|
||||
@item @option{-y <expression>}@tab y coordinate of text or image
|
||||
@item @option{-i <filename>} @tab The filename to read a image from
|
||||
@item @option{-R <expression>}@tab Value for R color
|
||||
@item @option{-G <expression>}@tab Value for G color
|
||||
@item @option{-B <expression>}@tab Value for B color
|
||||
@item @option{-A <expression>}@tab Value for Alpha channel
|
||||
@end multitable
|
||||
|
||||
Expressions are functions of these variables:
|
||||
@multitable @columnfractions .2 .8
|
||||
@item @var{N} @tab frame number (starting at zero)
|
||||
@item @var{H} @tab frame height
|
||||
@item @var{W} @tab frame width
|
||||
@item @var{h} @tab image height
|
||||
@item @var{w} @tab image width
|
||||
@item @var{X} @tab previous x coordinate of text or image
|
||||
@item @var{Y} @tab previous y coordinate of text or image
|
||||
@end multitable
|
||||
|
||||
You may also use the constants @var{PI}, @var{E}, and the math functions available at the
|
||||
FFmpeg formula evaluator at (@url{ffmpeg-doc.html#SEC13}), except @var{bits2qp(bits)}
|
||||
and @var{qp2bits(qp)}.
|
||||
|
||||
Usage examples:
|
||||
|
||||
@example
|
||||
# Remember to set the path to your fonts
|
||||
FONTPATH="/cygdrive/c/WINDOWS/Fonts/"
|
||||
FONTPATH="$FONTPATH:/usr/share/imlib2/data/fonts/"
|
||||
FONTPATH="$FONTPATH:/usr/X11R6/lib/X11/fonts/TTF/"
|
||||
export FONTPATH
|
||||
|
||||
# Bulb dancing in a Lissajous pattern
|
||||
ffmpeg -i input.avi -vhook \
|
||||
'vhook/imlib2.dll -x W*(0.5+0.25*sin(N/47*PI))-w/2 -y H*(0.5+0.50*cos(N/97*PI))-h/2 -i /usr/share/imlib2/data/images/bulb.png' \
|
||||
-acodec copy -sameq output.avi
|
||||
|
||||
# Text scrolling
|
||||
ffmpeg -i input.avi -vhook \
|
||||
'vhook/imlib2.dll -c red -F Vera.ttf/20 -x 150+0.5*N -y 70+0.25*N -t Hello' \
|
||||
-acodec copy -sameq output.avi
|
||||
|
||||
# Date and time stamp, security-camera style:
|
||||
ffmpeg -r 29.97 -s 320x256 -f video4linux -i /dev/video0 \
|
||||
-vhook 'vhook/imlib2.so -x 0 -y 0 -i black-260x20.png' \
|
||||
-vhook 'vhook/imlib2.so -c white -F VeraBd.ttf/12 -x 0 -y 0 -t %A-%D-%T' \
|
||||
output.avi
|
||||
|
||||
In this example the video is captured from the first video capture card as a
|
||||
320x256 AVI, and a black 260 by 20 pixel PNG image is placed in the upper
|
||||
left corner, with the day, date and time overlaid on it in Vera Bold 12
|
||||
point font. A simple black PNG file 260 pixels wide and 20 pixels tall
|
||||
was created in the GIMP for this purpose.
|
||||
|
||||
# Scrolling credits from a text file
|
||||
ffmpeg -i input.avi -vhook \
|
||||
'vhook/imlib2.so -c white -F VeraBd.ttf/16 -x 100 -y -1.0*N -f credits.txt' \
|
||||
-sameq output.avi
|
||||
|
||||
In this example, the text is stored in a file, and is positioned 100
|
||||
pixels from the left hand edge of the video. The text is scrolled from the
|
||||
bottom up. Making the y factor positive will scroll from the top down.
|
||||
Increasing the magnitude of the y factor makes the text scroll faster,
|
||||
decreasing it makes it scroll slower. Hint: Blank lines containing only
|
||||
a newline are treated as end-of-file. To create blank lines, use lines
|
||||
that consist of space characters only.
|
||||
|
||||
# Scrolling credits with custom color from a text file
|
||||
ffmpeg -i input.avi -vhook \
|
||||
'vhook/imlib2.so -C rgb.txt -c CustomColor1 -F VeraBd.ttf/16 -x 100 -y -1.0*N -f credits.txt' \
|
||||
-sameq output.avi
|
||||
|
||||
This example does the same as the one above, but specifies an rgb.txt file
|
||||
to be used, which has a custom-made color in it.
|
||||
|
||||
# Variable colors
|
||||
ffmpeg -i input.avi -vhook \
|
||||
'vhook/imlib2.so -t Hello -R abs(255*sin(N/47*PI)) -G abs(255*sin(N/47*PI)) -B abs(255*sin(N/47*PI))' \
|
||||
-sameq output.avi
|
||||
|
||||
In this example, the color for the text goes up and down from black to
|
||||
white.
|
||||
|
||||
# Text fade-out
|
||||
ffmpeg -i input.avi -vhook \
|
||||
'vhook/imlib2.so -t Hello -A max(0,255-exp(N/47))' \
|
||||
-sameq output.avi
|
||||
|
||||
In this example, the text fades out in about 10 seconds for a 25 fps input
|
||||
video file.
|
||||
|
||||
# scrolling credits from a graphics file
|
||||
ffmpeg -sameq -i input.avi \
|
||||
-vhook 'vhook/imlib2.so -x 0 -y -1.0*N -i credits.png' output.avi
|
||||
|
||||
In this example, a transparent PNG file the same width as the video
|
||||
(e.g. 320 pixels), but very long, (e.g. 3000 pixels), was created, and
|
||||
text, graphics, brushstrokes, etc, were added to the image. The image
|
||||
is then scrolled up, from the bottom of the frame.
|
||||
|
||||
@end example
|
||||
|
||||
@section ppm.c
|
||||
|
||||
It's basically a launch point for a PPM pipe, so you can use any
|
||||
executable (or script) which consumes a PPM on stdin and produces a PPM
|
||||
on stdout (and flushes each frame). The Netpbm utilities are a series of
|
||||
such programs.
|
||||
|
||||
A list of them is here:
|
||||
|
||||
@url{http://netpbm.sourceforge.net/doc/directory.html}
|
||||
|
||||
Usage example:
|
||||
|
||||
@example
|
||||
ffmpeg -i input -vhook "/path/to/ppm.so some-ppm-filter args" output
|
||||
@end example
|
||||
|
||||
@section drawtext.c
|
||||
|
||||
This module implements a text overlay for a video image. Currently it
|
||||
supports a fixed overlay or reading the text from a file. The string
|
||||
is passed through strftime() so that it is easy to imprint the date and
|
||||
time onto the image.
|
||||
|
||||
Features:
|
||||
@itemize @minus
|
||||
@item TrueType, Type1 and others via the FreeType2 library
|
||||
@item Font kerning (better output)
|
||||
@item Line Wrap (put the text that doesn't fit one line on the next line)
|
||||
@item Background box (currently in development)
|
||||
@item Outline
|
||||
@end itemize
|
||||
|
||||
Options:
|
||||
@multitable @columnfractions .2 .8
|
||||
@item @option{-c <color>} @tab Foreground color of the text ('internet' way) <#RRGGBB> [default #FFFFFF]
|
||||
@item @option{-C <color>} @tab Background color of the text ('internet' way) <#RRGGBB> [default #000000]
|
||||
@item @option{-f <font-filename>} @tab font file to use
|
||||
@item @option{-t <text>} @tab text to display
|
||||
@item @option{-T <filename>} @tab file to read text from
|
||||
@item @option{-x <pos>} @tab x coordinate of the start of the text
|
||||
@item @option{-y <pos>} @tab y coordinate of the start of the text
|
||||
@end multitable
|
||||
|
||||
Text fonts are being looked for in a FONTPATH environment variable.
|
||||
If the FONTPATH environment variable is not available, or is not checked by
|
||||
your target (i.e. Cygwin), then specify the full path to the font file as in:
|
||||
@example
|
||||
-f /usr/X11R6/lib/X11/fonts/TTF/VeraBd.ttf
|
||||
@end example
|
||||
|
||||
Usage Example:
|
||||
@example
|
||||
# Remember to set the path to your fonts
|
||||
FONTPATH="/cygdrive/c/WINDOWS/Fonts/"
|
||||
FONTPATH="$FONTPATH:/usr/share/imlib2/data/fonts/"
|
||||
FONTPATH="$FONTPATH:/usr/X11R6/lib/X11/fonts/TTF/"
|
||||
export FONTPATH
|
||||
|
||||
# Time and date display
|
||||
ffmpeg -f video4linux2 -i /dev/video0 \
|
||||
-vhook 'vhook/drawtext.so -f VeraBd.ttf -t %A-%D-%T' movie.mpg
|
||||
|
||||
This example grabs video from the first capture card and outputs it to an
|
||||
MPEG video, and places "Weekday-dd/mm/yy-hh:mm:ss" at the top left of the
|
||||
frame, updated every second, using the Vera Bold TrueType Font, which
|
||||
should exist in: /usr/X11R6/lib/X11/fonts/TTF/
|
||||
@end example
|
||||
|
||||
Check the man page for strftime() for all the various ways you can format
|
||||
the date and time.
|
||||
|
||||
@section watermark.c
|
||||
|
||||
Command Line options:
|
||||
@multitable @columnfractions .2 .8
|
||||
@item @option{-m [0|1]} @tab Mode (default: 0, see below)
|
||||
@item @option{-t 000000 - FFFFFF} @tab Threshold, six digit hex number
|
||||
@item @option{-f <filename>} @tab Watermark image filename, must be specified!
|
||||
@end multitable
|
||||
|
||||
MODE 0:
|
||||
The watermark picture works like this (assuming color intensities 0..0xFF):
|
||||
Per color do this:
|
||||
If mask color is 0x80, no change to the original frame.
|
||||
If mask color is < 0x80 the absolute difference is subtracted from the
|
||||
frame. If result < 0, result = 0.
|
||||
If mask color is > 0x80 the absolute difference is added to the
|
||||
frame. If result > 0xFF, result = 0xFF.
|
||||
|
||||
You can override the 0x80 level with the -t flag. E.g. if threshold is
|
||||
000000 the color value of watermark is added to the destination.
|
||||
|
||||
This way a mask that is visible both in light and dark pictures can be made
|
||||
(e.g. by using a picture generated by the Gimp and the bump map tool).
|
||||
|
||||
An example watermark file is at:
|
||||
@url{http://engene.se/ffmpeg_watermark.gif}
|
||||
|
||||
MODE 1:
|
||||
Per color do this:
|
||||
If mask color > threshold color then the watermark pixel is used.
|
||||
|
||||
Example usage:
|
||||
@example
|
||||
ffmpeg -i infile -vhook '/path/watermark.so -f wm.gif' -an out.mov
|
||||
ffmpeg -i infile -vhook '/path/watermark.so -f wm.gif -m 1 -t 222222' -an out.mov
|
||||
@end example
|
||||
|
||||
@bye
|
||||
@@ -1,228 +0,0 @@
|
||||
FFmpeg's bug/patch/feature request tracker manual
|
||||
=================================================
|
||||
|
||||
NOTE: This is a draft.
|
||||
|
||||
Overview:
|
||||
---------
|
||||
FFmpeg uses Roundup for tracking issues, new issues and changes to
|
||||
existing issues can be done through a web interface and through email.
|
||||
It is possible to subscribe to individual issues by adding yourself to the
|
||||
nosy list or to subscribe to the ffmpeg-issues mailing list which receives
|
||||
a mail for every change to every issue. Replies to such mails will also
|
||||
be properly added to the respective issue.
|
||||
(the above does all work already after light testing)
|
||||
The subscription URL for the ffmpeg-issues list is:
|
||||
http://live.polito/mailman/listinfo/ffmpeg-issues
|
||||
The URL of the webinterface of the tracker is:
|
||||
http(s)://roundup.ffmpeg/roundup/ffmpeg/
|
||||
Note the URLs in this document are obfuscated, you must append the top level
|
||||
domain for non-profit organizations to the tracker, and of Italy to the
|
||||
mailing list.
|
||||
|
||||
Email Interface:
|
||||
----------------
|
||||
There is a mailing list to which all new issues and changes to existing issues
|
||||
are sent. You can subscribe through
|
||||
http://live.polito/mailman/listinfo/ffmpeg-issues
|
||||
Replies to messages there will have their text added to the specific issues.
|
||||
Attachments will be added as if they had been uploaded via the web interface.
|
||||
You can change the status, substatus, topic, ... by changing the subject in
|
||||
your reply like:
|
||||
Re: [issue94] register_avcodec and allcodecs.h [type=patch;status=open;substatus=approved]
|
||||
Roundup will then change things as you requested and remove the [...] from
|
||||
the subject before forwarding the mail to the mailing list.
|
||||
|
||||
|
||||
NOTE: issue = (bug report || patch || feature request)
|
||||
|
||||
Type:
|
||||
-----
|
||||
bug
|
||||
An error, flaw, mistake, failure, or fault in FFmpeg or libav* that
|
||||
prevents it from behaving as intended.
|
||||
|
||||
feature request
|
||||
Request of support for encoding or decoding of a new codec, container
|
||||
or variant.
|
||||
Request of support for more, less or plain different output or behavior
|
||||
where the current implementation cannot be considered wrong.
|
||||
|
||||
patch
|
||||
A patch as generated by diff which conforms to the patch submission and
|
||||
development policy.
|
||||
|
||||
|
||||
Priority:
|
||||
---------
|
||||
critical
|
||||
Bugs and patches which deal with data loss and security issues.
|
||||
No feature request can be critical.
|
||||
|
||||
important
|
||||
Bugs which make FFmpeg unusable for a significant number of users, and
|
||||
patches fixing them.
|
||||
Examples here might be completely broken MPEG-4 decoding or a build issue
|
||||
on Linux.
|
||||
While broken 4xm decoding or a broken OS/2 build would not be important,
|
||||
the separation to normal is somewhat fuzzy.
|
||||
For feature requests this priority would be used for things many people
|
||||
want.
|
||||
|
||||
normal
|
||||
|
||||
|
||||
minor
|
||||
Bugs and patches about things like spelling errors, "mp2" instead of
|
||||
"mp3" being shown and such.
|
||||
Feature requests about things few people want or which do not make a big
|
||||
difference.
|
||||
|
||||
wish
|
||||
Something that is desirable to have but that there is no urgency at
|
||||
all to implement, e.g. something completely cosmetic like a website
|
||||
restyle or a personalized doxy template or the FFmpeg logo.
|
||||
This priority is not valid for bugs.
|
||||
|
||||
|
||||
Status:
|
||||
-------
|
||||
new
|
||||
initial state
|
||||
|
||||
open
|
||||
intermediate states
|
||||
|
||||
closed
|
||||
final state
|
||||
|
||||
|
||||
Type/Status/Substatus:
|
||||
----------
|
||||
*/new/new
|
||||
Initial state of new bugs, patches and feature requests submitted by
|
||||
users.
|
||||
|
||||
*/open/open
|
||||
Issues which have been briefly looked at and which did not look outright
|
||||
invalid.
|
||||
This implicates that no real more detailed state applies yet. Conversely,
|
||||
the more detailed states below implicate that the issue has been briefly
|
||||
looked at.
|
||||
|
||||
*/closed/duplicate
|
||||
Bugs, patches or feature requests which are duplicates.
|
||||
Note that patches dealing with the same thing in a different way are not
|
||||
duplicates.
|
||||
Note, if you mark something as duplicate, do not forget setting the
|
||||
superseder so bug reports are properly linked.
|
||||
|
||||
*/closed/invalid
|
||||
Bugs caused by user errors, random ineligible or otherwise nonsense stuff.
|
||||
|
||||
*/closed/needs_more_info
|
||||
Issues for which some information has been requested by the developers,
|
||||
but which has not been provided by anyone within reasonable time.
|
||||
|
||||
bug/open/reproduced
|
||||
Bugs which have been reproduced.
|
||||
|
||||
bug/open/analyzed
|
||||
Bugs which have been analyzed and where it is understood what causes them
|
||||
and which exact chain of events triggers them. This analysis should be
|
||||
available as a message in the bug report.
|
||||
Note, do not change the status to analyzed without also providing a clear
|
||||
and understandable analysis.
|
||||
This state implicates that the bug either has been reproduced or that
|
||||
reproduction is not needed as the bug is already understood.
|
||||
|
||||
bug/open/needs_more_info
|
||||
Bug reports which are incomplete and or where more information is needed
|
||||
from the submitter or another person who can provide it.
|
||||
This state implicates that the bug has not been analyzed or reproduced.
|
||||
Note, the idea behind needs_more_info is to offload work from the
|
||||
developers to the users whenever possible.
|
||||
|
||||
bug/closed/fixed
|
||||
Bugs which have to the best of our knowledge been fixed.
|
||||
|
||||
bug/closed/wont_fix
|
||||
Bugs which we will not fix. Possible reasons include legality, high
|
||||
complexity for the sake of supporting obscure corner cases, speed loss
|
||||
for similarly esoteric purposes, et cetera.
|
||||
This also means that we would reject a patch.
|
||||
If we are just too lazy to fix a bug then the correct state is open
|
||||
and unassigned. Closed means that the case is closed which is not
|
||||
the case if we are just waiting for a patch.
|
||||
|
||||
bug/closed/works_for_me
|
||||
Bugs for which sufficient information was provided to reproduce but
|
||||
reproduction failed - that is the code seems to work correctly to the
|
||||
best of our knowledge.
|
||||
|
||||
patch/open/approved
|
||||
Patches which have been reviewed and approved by a developer.
|
||||
Such patches can be applied anytime by any other developer after some
|
||||
reasonable testing (compile + regression tests + does the patch do
|
||||
what the author claimed).
|
||||
|
||||
patch/open/needs_changes
|
||||
Patches which have been reviewed and need changes to be accepted.
|
||||
|
||||
patch/closed/applied
|
||||
Patches which have been applied.
|
||||
|
||||
patch/closed/rejected
|
||||
Patches which have been rejected.
|
||||
|
||||
feature_request/open/needs_more_info
|
||||
Feature requests where it is not clear what exactly is wanted
|
||||
(these also could be closed as invalid ...).
|
||||
|
||||
feature_request/closed/implemented
|
||||
Feature requests which have been implemented.
|
||||
|
||||
feature_request/closed/wont_implement
|
||||
Feature requests which will not be implemented. The reasons here could
|
||||
be legal, philosophical or others.
|
||||
|
||||
Note, please do not use type-status-substatus combinations other than the
|
||||
above without asking on ffmpeg-dev first!
|
||||
|
||||
Note2, if you provide the requested info do not forget to remove the
|
||||
needs_more_info substate.
|
||||
|
||||
Topic:
|
||||
------
|
||||
A topic is a tag you should add to your issue in order to make grouping them
|
||||
easier.
|
||||
|
||||
avcodec
|
||||
issues in libavcodec/*
|
||||
|
||||
avformat
|
||||
issues in libavformat/*
|
||||
|
||||
avutil
|
||||
issues in libavutil/*
|
||||
|
||||
regression test
|
||||
issues in tests/*
|
||||
|
||||
ffmpeg
|
||||
issues in or related to ffmpeg.c
|
||||
|
||||
ffplay
|
||||
issues in or related to ffplay.c
|
||||
|
||||
ffserver
|
||||
issues in or related to ffserver.c
|
||||
|
||||
build system
|
||||
issues in or related to configure/Makefile
|
||||
|
||||
regression
|
||||
bugs which were working in a past revision
|
||||
|
||||
roundup
|
||||
issues related to our issue tracker
|
||||
@@ -1,235 +0,0 @@
|
||||
optimization Tips (for libavcodec):
|
||||
===================================
|
||||
|
||||
What to optimize:
|
||||
-----------------
|
||||
If you plan to do non-x86 architecture specific optimizations (SIMD normally),
|
||||
then take a look in the x86/ directory, as most important functions are
|
||||
already optimized for MMX.
|
||||
|
||||
If you want to do x86 optimizations then you can either try to finetune the
|
||||
stuff in the x86 directory or find some other functions in the C source to
|
||||
optimize, but there aren't many left.
|
||||
|
||||
|
||||
Understanding these overoptimized functions:
|
||||
--------------------------------------------
|
||||
As many functions tend to be a bit difficult to understand because
|
||||
of optimizations, it can be hard to optimize them further, or write
|
||||
architecture-specific versions. It is recommended to look at older
|
||||
revisions of the interesting files (for a web frontend try ViewVC at
|
||||
http://svn.ffmpeg.org/ffmpeg/trunk/).
|
||||
Alternatively, look into the other architecture-specific versions in
|
||||
the x86/, ppc/, alpha/ subdirectories. Even if you don't exactly
|
||||
comprehend the instructions, it could help understanding the functions
|
||||
and how they can be optimized.
|
||||
|
||||
NOTE: If you still don't understand some function, ask at our mailing list!!!
|
||||
(http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel)
|
||||
|
||||
|
||||
When is an optimization justified?
|
||||
----------------------------------
|
||||
Normally, clean and simple optimizations for widely used codecs are
|
||||
justified even if they only achieve an overall speedup of 0.1%. These
|
||||
speedups accumulate and can make a big difference after awhile. Also, if
|
||||
none of the following factors get worse due to an optimization -- speed,
|
||||
binary code size, source size, source readability -- and at least one
|
||||
factor improves, then an optimization is always a good idea even if the
|
||||
overall gain is less than 0.1%. For obscure codecs that are not often
|
||||
used, the goal is more toward keeping the code clean, small, and
|
||||
readable instead of making it 1% faster.
|
||||
|
||||
|
||||
WTF is that function good for ....:
|
||||
-----------------------------------
|
||||
The primary purpose of this list is to avoid wasting time optimizing functions
|
||||
which are rarely used.
|
||||
|
||||
put(_no_rnd)_pixels{,_x2,_y2,_xy2}
|
||||
Used in motion compensation (en/decoding).
|
||||
|
||||
avg_pixels{,_x2,_y2,_xy2}
|
||||
Used in motion compensation of B-frames.
|
||||
These are less important than the put*pixels functions.
|
||||
|
||||
avg_no_rnd_pixels*
|
||||
unused
|
||||
|
||||
pix_abs16x16{,_x2,_y2,_xy2}
|
||||
Used in motion estimation (encoding) with SAD.
|
||||
|
||||
pix_abs8x8{,_x2,_y2,_xy2}
|
||||
Used in motion estimation (encoding) with SAD of MPEG-4 4MV only.
|
||||
These are less important than the pix_abs16x16* functions.
|
||||
|
||||
put_mspel8_mc* / wmv2_mspel8*
|
||||
Used only in WMV2.
|
||||
it is not recommended that you waste your time with these, as WMV2
|
||||
is an ugly and relatively useless codec.
|
||||
|
||||
mpeg4_qpel* / *qpel_mc*
|
||||
Used in MPEG-4 qpel motion compensation (encoding & decoding).
|
||||
The qpel8 functions are used only for 4mv,
|
||||
the avg_* functions are used only for B-frames.
|
||||
Optimizing them should have a significant impact on qpel
|
||||
encoding & decoding.
|
||||
|
||||
qpel{8,16}_mc??_old_c / *pixels{8,16}_l4
|
||||
Just used to work around a bug in an old libavcodec encoder version.
|
||||
Don't optimize them.
|
||||
|
||||
tpel_mc_func {put,avg}_tpel_pixels_tab
|
||||
Used only for SVQ3, so only optimize them if you need fast SVQ3 decoding.
|
||||
|
||||
add_bytes/diff_bytes
|
||||
For huffyuv only, optimize if you want a faster ffhuffyuv codec.
|
||||
|
||||
get_pixels / diff_pixels
|
||||
Used for encoding, easy.
|
||||
|
||||
clear_blocks
|
||||
easiest to optimize
|
||||
|
||||
gmc
|
||||
Used for MPEG-4 gmc.
|
||||
Optimizing this should have a significant effect on the gmc decoding
|
||||
speed.
|
||||
|
||||
gmc1
|
||||
Used for chroma blocks in MPEG-4 gmc with 1 warp point
|
||||
(there are 4 luma & 2 chroma blocks per macroblock, so
|
||||
only 1/3 of the gmc blocks use this, the other 2/3
|
||||
use the normal put_pixel* code, but only if there is
|
||||
just 1 warp point).
|
||||
Note: DivX5 gmc always uses just 1 warp point.
|
||||
|
||||
pix_sum
|
||||
Used for encoding.
|
||||
|
||||
hadamard8_diff / sse / sad == pix_norm1 / dct_sad / quant_psnr / rd / bit
|
||||
Specific compare functions used in encoding, it depends upon the
|
||||
command line switches which of these are used.
|
||||
Don't waste your time with dct_sad & quant_psnr, they aren't
|
||||
really useful.
|
||||
|
||||
put_pixels_clamped / add_pixels_clamped
|
||||
Used for en/decoding in the IDCT, easy.
|
||||
Note, some optimized IDCTs have the add/put clamped code included and
|
||||
then put_pixels_clamped / add_pixels_clamped will be unused.
|
||||
|
||||
idct/fdct
|
||||
idct (encoding & decoding)
|
||||
fdct (encoding)
|
||||
difficult to optimize
|
||||
|
||||
dct_quantize_trellis
|
||||
Used for encoding with trellis quantization.
|
||||
difficult to optimize
|
||||
|
||||
dct_quantize
|
||||
Used for encoding.
|
||||
|
||||
dct_unquantize_mpeg1
|
||||
Used in MPEG-1 en/decoding.
|
||||
|
||||
dct_unquantize_mpeg2
|
||||
Used in MPEG-2 en/decoding.
|
||||
|
||||
dct_unquantize_h263
|
||||
Used in MPEG-4/H.263 en/decoding.
|
||||
|
||||
FIXME remaining functions?
|
||||
BTW, most of these functions are in dsputil.c/.h, some are in mpegvideo.c/.h.
|
||||
|
||||
|
||||
|
||||
Alignment:
|
||||
Some instructions on some architectures have strict alignment restrictions,
|
||||
for example most SSE/SSE2 instructions on x86.
|
||||
The minimum guaranteed alignment is written in the .h files, for example:
|
||||
void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, UINT8 *pixels/*align 8*/, int line_size);
|
||||
|
||||
|
||||
General Tips:
|
||||
-------------
|
||||
Use asm loops like:
|
||||
__asm__(
|
||||
"1: ....
|
||||
...
|
||||
"jump_instruciton ....
|
||||
Do not use C loops:
|
||||
do{
|
||||
__asm__(
|
||||
...
|
||||
}while()
|
||||
|
||||
Use __asm__() instead of intrinsics. The latter requires a good optimizing compiler
|
||||
which gcc is not.
|
||||
|
||||
|
||||
Links:
|
||||
======
|
||||
http://www.aggregate.org/MAGIC/
|
||||
|
||||
x86-specific:
|
||||
-------------
|
||||
http://developer.intel.com/design/pentium4/manuals/248966.htm
|
||||
|
||||
The IA-32 Intel Architecture Software Developer's Manual, Volume 2:
|
||||
Instruction Set Reference
|
||||
http://developer.intel.com/design/pentium4/manuals/245471.htm
|
||||
|
||||
http://www.agner.org/assem/
|
||||
|
||||
AMD Athlon Processor x86 Code Optimization Guide:
|
||||
http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/22007.pdf
|
||||
|
||||
|
||||
ARM-specific:
|
||||
-------------
|
||||
ARM Architecture Reference Manual (up to ARMv5TE):
|
||||
http://www.arm.com/community/university/eulaarmarm.html
|
||||
|
||||
Procedure Call Standard for the ARM Architecture:
|
||||
http://www.arm.com/pdfs/aapcs.pdf
|
||||
|
||||
Optimization guide for ARM9E (used in Nokia 770 Internet Tablet):
|
||||
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0240b/DDI0240A.pdf
|
||||
Optimization guide for ARM11 (used in Nokia N800 Internet Tablet):
|
||||
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0211j/DDI0211J_arm1136_r1p5_trm.pdf
|
||||
Optimization guide for Intel XScale (used in Sharp Zaurus PDA):
|
||||
http://download.intel.com/design/intelxscale/27347302.pdf
|
||||
Intel Wireless MMX2 Coprocessor: Programmers Reference Manual
|
||||
http://download.intel.com/design/intelxscale/31451001.pdf
|
||||
|
||||
PowerPC-specific:
|
||||
-----------------
|
||||
PowerPC32/AltiVec PIM:
|
||||
www.freescale.com/files/32bit/doc/ref_manual/ALTIVECPEM.pdf
|
||||
|
||||
PowerPC32/AltiVec PEM:
|
||||
www.freescale.com/files/32bit/doc/ref_manual/ALTIVECPIM.pdf
|
||||
|
||||
CELL/SPU:
|
||||
http://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/30B3520C93F437AB87257060006FFE5E/$file/Language_Extensions_for_CBEA_2.4.pdf
|
||||
http://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/9F820A5FFA3ECE8C8725716A0062585F/$file/CBE_Handbook_v1.1_24APR2007_pub.pdf
|
||||
|
||||
SPARC-specific:
|
||||
---------------
|
||||
SPARC Joint Programming Specification (JPS1): Commonality
|
||||
http://www.fujitsu.com/downloads/PRMPWR/JPS1-R1.0.4-Common-pub.pdf
|
||||
|
||||
UltraSPARC III Processor User's Manual (contains instruction timings)
|
||||
http://www.sun.com/processors/manuals/USIIIv2.pdf
|
||||
|
||||
VIS Whitepaper (contains optimization guidelines)
|
||||
http://www.sun.com/processors/vis/download/vis/vis_whitepaper.pdf
|
||||
|
||||
GCC asm links:
|
||||
--------------
|
||||
official doc but quite ugly
|
||||
http://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
|
||||
|
||||
a bit old (note "+" is valid for input-output, even though the next disagrees)
|
||||
http://www.cs.virginia.edu/~clc5q/gcc-inline-asm.pdf
|
||||
-630
@@ -1,630 +0,0 @@
|
||||
=============================================
|
||||
Snow Video Codec Specification Draft 20080110
|
||||
=============================================
|
||||
|
||||
Introduction:
|
||||
=============
|
||||
This specification describes the Snow bitstream syntax and semantics as
|
||||
well as the formal Snow decoding process.
|
||||
|
||||
The decoding process is described precisely and any compliant decoder
|
||||
MUST produce the exact same output for a spec-conformant Snow stream.
|
||||
For encoding, though, any process which generates a stream compliant to
|
||||
the syntactical and semantic requirements and which is decodable by
|
||||
the process described in this spec shall be considered a conformant
|
||||
Snow encoder.
|
||||
|
||||
Definitions:
|
||||
============
|
||||
|
||||
MUST the specific part must be done to conform to this standard
|
||||
SHOULD it is recommended to be done that way, but not strictly required
|
||||
|
||||
ilog2(x) is the rounded down logarithm of x with basis 2
|
||||
ilog2(0) = 0
|
||||
|
||||
Type definitions:
|
||||
=================
|
||||
|
||||
b 1-bit range coded
|
||||
u unsigned scalar value range coded
|
||||
s signed scalar value range coded
|
||||
|
||||
|
||||
Bitstream syntax:
|
||||
=================
|
||||
|
||||
frame:
|
||||
header
|
||||
prediction
|
||||
residual
|
||||
|
||||
header:
|
||||
keyframe b MID_STATE
|
||||
if(keyframe || always_reset)
|
||||
reset_contexts
|
||||
if(keyframe){
|
||||
version u header_state
|
||||
always_reset b header_state
|
||||
temporal_decomposition_type u header_state
|
||||
temporal_decomposition_count u header_state
|
||||
spatial_decomposition_count u header_state
|
||||
colorspace_type u header_state
|
||||
chroma_h_shift u header_state
|
||||
chroma_v_shift u header_state
|
||||
spatial_scalability b header_state
|
||||
max_ref_frames-1 u header_state
|
||||
qlogs
|
||||
}
|
||||
if(!keyframe){
|
||||
update_mc b header_state
|
||||
if(update_mc){
|
||||
for(plane=0; plane<2; plane++){
|
||||
diag_mc b header_state
|
||||
htaps/2-1 u header_state
|
||||
for(i= p->htaps/2; i; i--)
|
||||
|hcoeff[i]| u header_state
|
||||
}
|
||||
}
|
||||
update_qlogs b header_state
|
||||
if(update_qlogs){
|
||||
spatial_decomposition_count u header_state
|
||||
qlogs
|
||||
}
|
||||
}
|
||||
|
||||
spatial_decomposition_type s header_state
|
||||
qlog s header_state
|
||||
mv_scale s header_state
|
||||
qbias s header_state
|
||||
block_max_depth s header_state
|
||||
|
||||
qlogs:
|
||||
for(plane=0; plane<2; plane++){
|
||||
quant_table[plane][0][0] s header_state
|
||||
for(level=0; level < spatial_decomposition_count; level++){
|
||||
quant_table[plane][level][1]s header_state
|
||||
quant_table[plane][level][3]s header_state
|
||||
}
|
||||
}
|
||||
|
||||
reset_contexts
|
||||
*_state[*]= MID_STATE
|
||||
|
||||
prediction:
|
||||
for(y=0; y<block_count_vertical; y++)
|
||||
for(x=0; x<block_count_horizontal; x++)
|
||||
block(0)
|
||||
|
||||
block(level):
|
||||
mvx_diff=mvy_diff=y_diff=cb_diff=cr_diff=0
|
||||
if(keyframe){
|
||||
intra=1
|
||||
}else{
|
||||
if(level!=max_block_depth){
|
||||
s_context= 2*left->level + 2*top->level + topleft->level + topright->level
|
||||
leaf b block_state[4 + s_context]
|
||||
}
|
||||
if(level==max_block_depth || leaf){
|
||||
intra b block_state[1 + left->intra + top->intra]
|
||||
if(intra){
|
||||
y_diff s block_state[32]
|
||||
cb_diff s block_state[64]
|
||||
cr_diff s block_state[96]
|
||||
}else{
|
||||
ref_context= ilog2(2*left->ref) + ilog2(2*top->ref)
|
||||
if(ref_frames > 1)
|
||||
ref u block_state[128 + 1024 + 32*ref_context]
|
||||
mx_context= ilog2(2*abs(left->mx - top->mx))
|
||||
my_context= ilog2(2*abs(left->my - top->my))
|
||||
mvx_diff s block_state[128 + 32*(mx_context + 16*!!ref)]
|
||||
mvy_diff s block_state[128 + 32*(my_context + 16*!!ref)]
|
||||
}
|
||||
}else{
|
||||
block(level+1)
|
||||
block(level+1)
|
||||
block(level+1)
|
||||
block(level+1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
residual:
|
||||
residual2(luma)
|
||||
residual2(chroma_cr)
|
||||
residual2(chroma_cb)
|
||||
|
||||
residual2:
|
||||
for(level=0; level<spatial_decomposition_count; level++){
|
||||
if(level==0)
|
||||
subband(LL, 0)
|
||||
subband(HL, level)
|
||||
subband(LH, level)
|
||||
subband(HH, level)
|
||||
}
|
||||
|
||||
subband:
|
||||
FIXME
|
||||
|
||||
|
||||
|
||||
Tag description:
|
||||
----------------
|
||||
|
||||
version
|
||||
0
|
||||
this MUST NOT change within a bitstream
|
||||
|
||||
always_reset
|
||||
if 1 then the range coder contexts will be reset after each frame
|
||||
|
||||
temporal_decomposition_type
|
||||
0
|
||||
|
||||
temporal_decomposition_count
|
||||
0
|
||||
|
||||
spatial_decomposition_count
|
||||
FIXME
|
||||
|
||||
colorspace_type
|
||||
0
|
||||
this MUST NOT change within a bitstream
|
||||
|
||||
chroma_h_shift
|
||||
log2(luma.width / chroma.width)
|
||||
this MUST NOT change within a bitstream
|
||||
|
||||
chroma_v_shift
|
||||
log2(luma.height / chroma.height)
|
||||
this MUST NOT change within a bitstream
|
||||
|
||||
spatial_scalability
|
||||
0
|
||||
|
||||
max_ref_frames
|
||||
maximum number of reference frames
|
||||
this MUST NOT change within a bitstream
|
||||
|
||||
update_mc
|
||||
indicates that motion compensation filter parameters are stored in the
|
||||
header
|
||||
|
||||
diag_mc
|
||||
flag to enable faster diagonal interpolation
|
||||
this SHOULD be 1 unless it turns out to be covered by a valid patent
|
||||
|
||||
htaps
|
||||
number of half pel interpolation filter taps, MUST be even, >0 and <10
|
||||
|
||||
hcoeff
|
||||
half pel interpolation filter coefficients, hcoeff[0] are the 2 middle
|
||||
coefficients [1] are the next outer ones and so on, resulting in a filter
|
||||
like: ...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ...
|
||||
the sign of the coefficients is not explicitly stored but alternates
|
||||
after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,...
|
||||
hcoeff[0] is not explicitly stored but found by subtracting the sum
|
||||
of all stored coefficients with signs from 32
|
||||
hcoeff[0]= 32 - hcoeff[1] - hcoeff[2] - ...
|
||||
a good choice for hcoeff and htaps is
|
||||
htaps= 6
|
||||
hcoeff={40,-10,2}
|
||||
an alternative which requires more computations at both encoder and
|
||||
decoder side and may or may not be better is
|
||||
htaps= 8
|
||||
hcoeff={42,-14,6,-2}
|
||||
|
||||
|
||||
ref_frames
|
||||
minimum of the number of available reference frames and max_ref_frames
|
||||
for example the first frame after a key frame always has ref_frames=1
|
||||
|
||||
spatial_decomposition_type
|
||||
wavelet type
|
||||
0 is a 9/7 symmetric compact integer wavelet
|
||||
1 is a 5/3 symmetric compact integer wavelet
|
||||
others are reserved
|
||||
stored as delta from last, last is reset to 0 if always_reset || keyframe
|
||||
|
||||
qlog
|
||||
quality (logarthmic quantizer scale)
|
||||
stored as delta from last, last is reset to 0 if always_reset || keyframe
|
||||
|
||||
mv_scale
|
||||
stored as delta from last, last is reset to 0 if always_reset || keyframe
|
||||
FIXME check that everything works fine if this changes between frames
|
||||
|
||||
qbias
|
||||
dequantization bias
|
||||
stored as delta from last, last is reset to 0 if always_reset || keyframe
|
||||
|
||||
block_max_depth
|
||||
maximum depth of the block tree
|
||||
stored as delta from last, last is reset to 0 if always_reset || keyframe
|
||||
|
||||
quant_table
|
||||
quantiztation table
|
||||
|
||||
|
||||
Highlevel bitstream structure:
|
||||
=============================
|
||||
--------------------------------------------
|
||||
| Header |
|
||||
--------------------------------------------
|
||||
| ------------------------------------ |
|
||||
| | Block0 | |
|
||||
| | split? | |
|
||||
| | yes no | |
|
||||
| | ......... intra? | |
|
||||
| | : Block01 : yes no | |
|
||||
| | : Block02 : ....... .......... | |
|
||||
| | : Block03 : : y DC : : ref index: | |
|
||||
| | : Block04 : : cb DC : : motion x : | |
|
||||
| | ......... : cr DC : : motion y : | |
|
||||
| | ....... .......... | |
|
||||
| ------------------------------------ |
|
||||
| ------------------------------------ |
|
||||
| | Block1 | |
|
||||
| ... |
|
||||
--------------------------------------------
|
||||
| ------------ ------------ ------------ |
|
||||
|| Y subbands | | Cb subbands| | Cr subbands||
|
||||
|| --- --- | | --- --- | | --- --- ||
|
||||
|| |LL0||HL0| | | |LL0||HL0| | | |LL0||HL0| ||
|
||||
|| --- --- | | --- --- | | --- --- ||
|
||||
|| --- --- | | --- --- | | --- --- ||
|
||||
|| |LH0||HH0| | | |LH0||HH0| | | |LH0||HH0| ||
|
||||
|| --- --- | | --- --- | | --- --- ||
|
||||
|| --- --- | | --- --- | | --- --- ||
|
||||
|| |HL1||LH1| | | |HL1||LH1| | | |HL1||LH1| ||
|
||||
|| --- --- | | --- --- | | --- --- ||
|
||||
|| --- --- | | --- --- | | --- --- ||
|
||||
|| |HH1||HL2| | | |HH1||HL2| | | |HH1||HL2| ||
|
||||
|| ... | | ... | | ... ||
|
||||
| ------------ ------------ ------------ |
|
||||
--------------------------------------------
|
||||
|
||||
Decoding process:
|
||||
=================
|
||||
|
||||
------------
|
||||
| |
|
||||
| Subbands |
|
||||
------------ | |
|
||||
| | ------------
|
||||
| Intra DC | |
|
||||
| | LL0 subband prediction
|
||||
------------ |
|
||||
\ Dequantizaton
|
||||
------------------- \ |
|
||||
| Reference frames | \ IDWT
|
||||
| ------- ------- | Motion \ |
|
||||
||Frame 0| |Frame 1|| Compensation . OBMC v -------
|
||||
| ------- ------- | --------------. \------> + --->|Frame n|-->output
|
||||
| ------- ------- | -------
|
||||
||Frame 2| |Frame 3||<----------------------------------/
|
||||
| ... |
|
||||
-------------------
|
||||
|
||||
|
||||
Range Coder:
|
||||
============
|
||||
|
||||
Binary Range Coder:
|
||||
-------------------
|
||||
The implemented range coder is an adapted version based upon "Range encoding:
|
||||
an algorithm for removing redundancy from a digitised message." by G. N. N.
|
||||
Martin.
|
||||
The symbols encoded by the Snow range coder are bits (0|1). The
|
||||
associated probabilities are not fix but change depending on the symbol mix
|
||||
seen so far.
|
||||
|
||||
|
||||
bit seen | new state
|
||||
---------+-----------------------------------------------
|
||||
0 | 256 - state_transition_table[256 - old_state];
|
||||
1 | state_transition_table[ old_state];
|
||||
|
||||
state_transition_table = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27,
|
||||
28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42,
|
||||
43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57,
|
||||
58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
|
||||
74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
|
||||
89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
|
||||
104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118,
|
||||
119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133,
|
||||
134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
|
||||
150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
|
||||
165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179,
|
||||
180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194,
|
||||
195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209,
|
||||
210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225,
|
||||
226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240,
|
||||
241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
Range Coding of integers:
|
||||
-------------------------
|
||||
FIXME
|
||||
|
||||
|
||||
Neighboring Blocks:
|
||||
===================
|
||||
left and top are set to the respective blocks unless they are outside of
|
||||
the image in which case they are set to the Null block
|
||||
|
||||
top-left is set to the top left block unless it is outside of the image in
|
||||
which case it is set to the left block
|
||||
|
||||
if this block has no larger parent block or it is at the left side of its
|
||||
parent block and the top right block is not outside of the image then the
|
||||
top right block is used for top-right else the top-left block is used
|
||||
|
||||
Null block
|
||||
y,cb,cr are 128
|
||||
level, ref, mx and my are 0
|
||||
|
||||
|
||||
Motion Vector Prediction:
|
||||
=========================
|
||||
1. the motion vectors of all the neighboring blocks are scaled to
|
||||
compensate for the difference of reference frames
|
||||
|
||||
scaled_mv= (mv * (256 * (current_reference+1) / (mv.reference+1)) + 128)>>8
|
||||
|
||||
2. the median of the scaled left, top and top-right vectors is used as
|
||||
motion vector prediction
|
||||
|
||||
3. the used motion vector is the sum of the predictor and
|
||||
(mvx_diff, mvy_diff)*mv_scale
|
||||
|
||||
|
||||
Intra DC Predicton:
|
||||
======================
|
||||
the luma and chroma values of the left block are used as predictors
|
||||
|
||||
the used luma and chroma is the sum of the predictor and y_diff, cb_diff, cr_diff
|
||||
to reverse this in the decoder apply the following:
|
||||
block[y][x].dc[0] = block[y][x-1].dc[0] + y_diff;
|
||||
block[y][x].dc[1] = block[y][x-1].dc[1] + cb_diff;
|
||||
block[y][x].dc[2] = block[y][x-1].dc[2] + cr_diff;
|
||||
block[*][-1].dc[*]= 128;
|
||||
|
||||
|
||||
Motion Compensation:
|
||||
====================
|
||||
|
||||
Halfpel interpolation:
|
||||
----------------------
|
||||
halfpel interpolation is done by convolution with the halfpel filter stored
|
||||
in the header:
|
||||
|
||||
horizontal halfpel samples are found by
|
||||
H1[y][x] = hcoeff[0]*(F[y][x ] + F[y][x+1])
|
||||
+ hcoeff[1]*(F[y][x-1] + F[y][x+2])
|
||||
+ hcoeff[2]*(F[y][x-2] + F[y][x+3])
|
||||
+ ...
|
||||
h1[y][x] = (H1[y][x] + 32)>>6;
|
||||
|
||||
vertical halfpel samples are found by
|
||||
H2[y][x] = hcoeff[0]*(F[y ][x] + F[y+1][x])
|
||||
+ hcoeff[1]*(F[y-1][x] + F[y+2][x])
|
||||
+ ...
|
||||
h2[y][x] = (H2[y][x] + 32)>>6;
|
||||
|
||||
vertical+horizontal halfpel samples are found by
|
||||
H3[y][x] = hcoeff[0]*(H2[y][x ] + H2[y][x+1])
|
||||
+ hcoeff[1]*(H2[y][x-1] + H2[y][x+2])
|
||||
+ ...
|
||||
H3[y][x] = hcoeff[0]*(H1[y ][x] + H1[y+1][x])
|
||||
+ hcoeff[1]*(H1[y+1][x] + H1[y+2][x])
|
||||
+ ...
|
||||
h3[y][x] = (H3[y][x] + 2048)>>12;
|
||||
|
||||
|
||||
F H1 F
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
F H1 F
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
F-------F-------F-> H1<-F-------F-------F
|
||||
v v v
|
||||
H2 H3 H2
|
||||
^ ^ ^
|
||||
F-------F-------F-> H1<-F-------F-------F
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
F H1 F
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
F H1 F
|
||||
|
||||
|
||||
unavailable fullpel samples (outside the picture for example) shall be equal
|
||||
to the closest available fullpel sample
|
||||
|
||||
|
||||
Smaller pel interpolation:
|
||||
--------------------------
|
||||
if diag_mc is set then points which lie on a line between 2 vertically,
|
||||
horiziontally or diagonally adjacent halfpel points shall be interpolated
|
||||
linearls with rounding to nearest and halfway values rounded up.
|
||||
points which lie on 2 diagonals at the same time should only use the one
|
||||
diagonal not containing the fullpel point
|
||||
|
||||
|
||||
|
||||
F-->O---q---O<--h1->O---q---O<--F
|
||||
v \ / v \ / v
|
||||
O O O O O O O
|
||||
| / | \ |
|
||||
q q q q q
|
||||
| / | \ |
|
||||
O O O O O O O
|
||||
^ / \ ^ / \ ^
|
||||
h2-->O---q---O<--h3->O---q---O<--h2
|
||||
v \ / v \ / v
|
||||
O O O O O O O
|
||||
| \ | / |
|
||||
q q q q q
|
||||
| \ | / |
|
||||
O O O O O O O
|
||||
^ / \ ^ / \ ^
|
||||
F-->O---q---O<--h1->O---q---O<--F
|
||||
|
||||
|
||||
|
||||
the remaining points shall be bilinearly interpolated from the
|
||||
up to 4 surrounding halfpel and fullpel points, again rounding should be to
|
||||
nearest and halfway values rounded up
|
||||
|
||||
compliant Snow decoders MUST support 1-1/8 pel luma and 1/2-1/16 pel chroma
|
||||
interpolation at least
|
||||
|
||||
|
||||
Overlapped block motion compensation:
|
||||
-------------------------------------
|
||||
FIXME
|
||||
|
||||
LL band prediction:
|
||||
===================
|
||||
Each sample in the LL0 subband is predicted by the median of the left, top and
|
||||
left+top-topleft samples, samples outside the subband shall be considered to
|
||||
be 0. To reverse this prediction in the decoder apply the following.
|
||||
for(y=0; y<height; y++){
|
||||
for(x=0; x<width; x++){
|
||||
sample[y][x] += median(sample[y-1][x],
|
||||
sample[y][x-1],
|
||||
sample[y-1][x]+sample[y][x-1]-sample[y-1][x-1]);
|
||||
}
|
||||
}
|
||||
sample[-1][*]=sample[*][-1]= 0;
|
||||
width,height here are the width and height of the LL0 subband not of the final
|
||||
video
|
||||
|
||||
|
||||
Dequantizaton:
|
||||
==============
|
||||
FIXME
|
||||
|
||||
Wavelet Transform:
|
||||
==================
|
||||
|
||||
Snow supports 2 wavelet transforms, the symmetric biorthogonal 5/3 integer
|
||||
transform and a integer approximation of the symmetric biorthogonal 9/7
|
||||
daubechies wavelet.
|
||||
|
||||
2D IDWT (inverse discrete wavelet transform)
|
||||
--------------------------------------------
|
||||
The 2D IDWT applies a 2D filter recursively, each time combining the
|
||||
4 lowest frequency subbands into a single subband until only 1 subband
|
||||
remains.
|
||||
The 2D filter is done by first applying a 1D filter in the vertical direction
|
||||
and then applying it in the horizontal one.
|
||||
--------------- --------------- --------------- ---------------
|
||||
|LL0|HL0| | | | | | | | | | | |
|
||||
|---+---| HL1 | | L0|H0 | HL1 | | LL1 | HL1 | | | |
|
||||
|LH0|HH0| | | | | | | | | | | |
|
||||
|-------+-------|->|-------+-------|->|-------+-------|->| L1 | H1 |->...
|
||||
| | | | | | | | | | | |
|
||||
| LH1 | HH1 | | LH1 | HH1 | | LH1 | HH1 | | | |
|
||||
| | | | | | | | | | | |
|
||||
--------------- --------------- --------------- ---------------
|
||||
|
||||
|
||||
1D Filter:
|
||||
----------
|
||||
1. interleave the samples of the low and high frequency subbands like
|
||||
s={L0, H0, L1, H1, L2, H2, L3, H3, ... }
|
||||
note, this can end with a L or a H, the number of elements shall be w
|
||||
s[-1] shall be considered equivalent to s[1 ]
|
||||
s[w ] shall be considered equivalent to s[w-2]
|
||||
|
||||
2. perform the lifting steps in order as described below
|
||||
|
||||
5/3 Integer filter:
|
||||
1. s[i] -= (s[i-1] + s[i+1] + 2)>>2; for all even i < w
|
||||
2. s[i] += (s[i-1] + s[i+1] )>>1; for all odd i < w
|
||||
|
||||
\ | /|\ | /|\ | /|\ | /|\
|
||||
\|/ | \|/ | \|/ | \|/ |
|
||||
+ | + | + | + | -1/4
|
||||
/|\ | /|\ | /|\ | /|\ |
|
||||
/ | \|/ | \|/ | \|/ | \|/
|
||||
| + | + | + | + +1/2
|
||||
|
||||
|
||||
Snow's 9/7 Integer filter:
|
||||
1. s[i] -= (3*(s[i-1] + s[i+1]) + 4)>>3; for all even i < w
|
||||
2. s[i] -= s[i-1] + s[i+1] ; for all odd i < w
|
||||
3. s[i] += ( s[i-1] + s[i+1] + 4*s[i] + 8)>>4; for all even i < w
|
||||
4. s[i] += (3*(s[i-1] + s[i+1]) )>>1; for all odd i < w
|
||||
|
||||
\ | /|\ | /|\ | /|\ | /|\
|
||||
\|/ | \|/ | \|/ | \|/ |
|
||||
+ | + | + | + | -3/8
|
||||
/|\ | /|\ | /|\ | /|\ |
|
||||
/ | \|/ | \|/ | \|/ | \|/
|
||||
(| + (| + (| + (| + -1
|
||||
\ + /|\ + /|\ + /|\ + /|\ +1/4
|
||||
\|/ | \|/ | \|/ | \|/ |
|
||||
+ | + | + | + | +1/16
|
||||
/|\ | /|\ | /|\ | /|\ |
|
||||
/ | \|/ | \|/ | \|/ | \|/
|
||||
| + | + | + | + +3/2
|
||||
|
||||
optimization tips:
|
||||
following are exactly identical
|
||||
(3a)>>1 == a + (a>>1)
|
||||
(a + 4b + 8)>>4 == ((a>>2) + b + 2)>>2
|
||||
|
||||
16bit implementation note:
|
||||
The IDWT can be implemented with 16bits, but this requires some care to
|
||||
prevent overflows, the following list, lists the minimum number of bits needed
|
||||
for some terms
|
||||
1. lifting step
|
||||
A= s[i-1] + s[i+1] 16bit
|
||||
3*A + 4 18bit
|
||||
A + (A>>1) + 2 17bit
|
||||
|
||||
3. lifting step
|
||||
s[i-1] + s[i+1] 17bit
|
||||
|
||||
4. lifiting step
|
||||
3*(s[i-1] + s[i+1]) 17bit
|
||||
|
||||
|
||||
TODO:
|
||||
=====
|
||||
Important:
|
||||
finetune initial contexts
|
||||
flip wavelet?
|
||||
try to use the wavelet transformed predicted image (motion compensated image) as context for coding the residual coefficients
|
||||
try the MV length as context for coding the residual coefficients
|
||||
use extradata for stuff which is in the keyframes now?
|
||||
the MV median predictor is patented IIRC
|
||||
implement per picture halfpel interpolation
|
||||
try different range coder state transition tables for different contexts
|
||||
|
||||
Not Important:
|
||||
compare the 6 tap and 8 tap hpel filters (psnr/bitrate and subjective quality)
|
||||
spatial_scalability b vs u (!= 0 breaks syntax anyway so we can add a u later)
|
||||
|
||||
|
||||
Credits:
|
||||
========
|
||||
Michael Niedermayer
|
||||
Loren Merritt
|
||||
|
||||
|
||||
Copyright:
|
||||
==========
|
||||
GPL + GFDL + whatever is needed to make this a RFC
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
Google Summer of Code and similar project guidelines
|
||||
|
||||
Summer of Code is a project by Google in which students are paid to implement
|
||||
some nice new features for various participating open source projects ...
|
||||
|
||||
This text is a collection of things to take care of for the next soc as
|
||||
it's a little late for this year's soc (2006).
|
||||
|
||||
The Goal:
|
||||
Our goal in respect to soc is and must be of course exactly one thing and
|
||||
that is to improve FFmpeg, to reach this goal, code must
|
||||
* conform to the svn policy and patch submission guidelines
|
||||
* must improve FFmpeg somehow (faster, smaller, "better",
|
||||
more codecs supported, fewer bugs, cleaner, ...)
|
||||
|
||||
for mentors and other developers to help students to reach that goal it is
|
||||
essential that changes to their codebase are publicly visible, clean and
|
||||
easy reviewable that again leads us to:
|
||||
* use of a revision control system like svn
|
||||
* separation of cosmetic from non-cosmetic changes (this is almost entirely
|
||||
ignored by mentors and students in soc 2006 which might lead to a suprise
|
||||
when the code will be reviewed at the end before a possible inclusion in
|
||||
FFmpeg, individual changes were generally not reviewable due to cosmetics).
|
||||
* frequent commits, so that comments can be provided early
|
||||
@@ -1,99 +0,0 @@
|
||||
The official guide to swscale for confused developers.
|
||||
========================================================
|
||||
|
||||
Current (simplified) Architecture:
|
||||
---------------------------------
|
||||
Input
|
||||
v
|
||||
_______OR_________
|
||||
/ \
|
||||
/ \
|
||||
special converter [Input to YUV converter]
|
||||
| |
|
||||
| (8bit YUV 4:4:4 / 4:2:2 / 4:2:0 / 4:0:0 )
|
||||
| |
|
||||
| v
|
||||
| Horizontal scaler
|
||||
| |
|
||||
| (15bit YUV 4:4:4 / 4:2:2 / 4:2:0 / 4:1:1 / 4:0:0 )
|
||||
| |
|
||||
| v
|
||||
| Vertical scaler and output converter
|
||||
| |
|
||||
v v
|
||||
output
|
||||
|
||||
|
||||
Swscale has 2 scaler paths. Each side must be capable of handling
|
||||
slices, that is, consecutive non-overlapping rectangles of dimension
|
||||
(0,slice_top) - (picture_width, slice_bottom).
|
||||
|
||||
special converter
|
||||
These generally are unscaled converters of common
|
||||
formats, like YUV 4:2:0/4:2:2 -> RGB15/16/24/32. Though it could also
|
||||
in principle contain scalers optimized for specific common cases.
|
||||
|
||||
Main path
|
||||
The main path is used when no special converter can be used. The code
|
||||
is designed as a destination line pull architecture. That is, for each
|
||||
output line the vertical scaler pulls lines from a ring buffer. When
|
||||
the ring buffer does not contain the wanted line, then it is pulled from
|
||||
the input slice through the input converter and horizontal scaler.
|
||||
The result is also stored in the ring buffer to serve future vertical
|
||||
scaler requests.
|
||||
When no more output can be generated because lines from a future slice
|
||||
would be needed, then all remaining lines in the current slice are
|
||||
converted, horizontally scaled and put in the ring buffer.
|
||||
[This is done for luma and chroma, each with possibly different numbers
|
||||
of lines per picture.]
|
||||
|
||||
Input to YUV Converter
|
||||
When the input to the main path is not planar 8 bits per component YUV or
|
||||
8-bit gray, it is converted to planar 8-bit YUV. Two sets of converters
|
||||
exist for this currently: One performs horizontal downscaling by 2
|
||||
before the conversion, the other leaves the full chroma resolution,
|
||||
but is slightly slower. The scaler will try to preserve full chroma
|
||||
when the output uses it. It is possible to force full chroma with
|
||||
SWS_FULL_CHR_H_INP even for cases where the scaler thinks it is useless.
|
||||
|
||||
Horizontal scaler
|
||||
There are several horizontal scalers. A special case worth mentioning is
|
||||
the fast bilinear scaler that is made of runtime-generated MMX2 code
|
||||
using specially tuned pshufw instructions.
|
||||
The remaining scalers are specially-tuned for various filter lengths.
|
||||
They scale 8-bit unsigned planar data to 16-bit signed planar data.
|
||||
Future >8 bits per component inputs will need to add a new horizontal
|
||||
scaler that preserves the input precision.
|
||||
|
||||
Vertical scaler and output converter
|
||||
There is a large number of combined vertical scalers + output converters.
|
||||
Some are:
|
||||
* unscaled output converters
|
||||
* unscaled output converters that average 2 chroma lines
|
||||
* bilinear converters (C, MMX and accurate MMX)
|
||||
* arbitrary filter length converters (C, MMX and accurate MMX)
|
||||
And
|
||||
* Plain C 8-bit 4:2:2 YUV -> RGB converters using LUTs
|
||||
* Plain C 17-bit 4:4:4 YUV -> RGB converters using multiplies
|
||||
* MMX 11-bit 4:2:2 YUV -> RGB converters
|
||||
* Plain C 16-bit Y -> 16-bit gray
|
||||
...
|
||||
|
||||
RGB with less than 8 bits per component uses dither to improve the
|
||||
subjective quality and low-frequency accuracy.
|
||||
|
||||
|
||||
Filter coefficients:
|
||||
--------------------
|
||||
There are several different scalers (bilinear, bicubic, lanczos, area,
|
||||
sinc, ...). Their coefficients are calculated in initFilter().
|
||||
Horizontal filter coefficients have a 1.0 point at 1 << 14, vertical ones at
|
||||
1 << 12. The 1.0 points have been chosen to maximize precision while leaving
|
||||
a little headroom for convolutional filters like sharpening filters and
|
||||
minimizing SIMD instructions needed to apply them.
|
||||
It would be trivial to use a different 1.0 point if some specific scaler
|
||||
would benefit from it.
|
||||
Also, as already hinted at, initFilter() accepts an optional convolutional
|
||||
filter as input that can be used for contrast, saturation, blur, sharpening
|
||||
shift, chroma vs. luma shift, ...
|
||||
|
||||
-427
@@ -1,427 +0,0 @@
|
||||
#! /usr/bin/perl -w
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This file is part of GNU CC.
|
||||
|
||||
# GNU CC 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, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# GNU CC is distributed in the hope that 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 GNU CC; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301 USA
|
||||
|
||||
# This does trivial (and I mean _trivial_) conversion of Texinfo
|
||||
# markup to Perl POD format. It's intended to be used to extract
|
||||
# something suitable for a manpage from a Texinfo document.
|
||||
|
||||
$output = 0;
|
||||
$skipping = 0;
|
||||
%sects = ();
|
||||
$section = "";
|
||||
@icstack = ();
|
||||
@endwstack = ();
|
||||
@skstack = ();
|
||||
@instack = ();
|
||||
$shift = "";
|
||||
%defs = ();
|
||||
$fnno = 1;
|
||||
$inf = "";
|
||||
$ibase = "";
|
||||
|
||||
while ($_ = shift) {
|
||||
if (/^-D(.*)$/) {
|
||||
if ($1 ne "") {
|
||||
$flag = $1;
|
||||
} else {
|
||||
$flag = shift;
|
||||
}
|
||||
$value = "";
|
||||
($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/);
|
||||
die "no flag specified for -D\n"
|
||||
unless $flag ne "";
|
||||
die "flags may only contain letters, digits, hyphens, dashes and underscores\n"
|
||||
unless $flag =~ /^[a-zA-Z0-9_-]+$/;
|
||||
$defs{$flag} = $value;
|
||||
} elsif (/^-/) {
|
||||
usage();
|
||||
} else {
|
||||
$in = $_, next unless defined $in;
|
||||
$out = $_, next unless defined $out;
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (defined $in) {
|
||||
$inf = gensym();
|
||||
open($inf, "<$in") or die "opening \"$in\": $!\n";
|
||||
$ibase = $1 if $in =~ m|^(.+)/[^/]+$|;
|
||||
} else {
|
||||
$inf = \*STDIN;
|
||||
}
|
||||
|
||||
if (defined $out) {
|
||||
open(STDOUT, ">$out") or die "opening \"$out\": $!\n";
|
||||
}
|
||||
|
||||
while(defined $inf) {
|
||||
while(<$inf>) {
|
||||
# Certain commands are discarded without further processing.
|
||||
/^\@(?:
|
||||
[a-z]+index # @*index: useful only in complete manual
|
||||
|need # @need: useful only in printed manual
|
||||
|(?:end\s+)?group # @group .. @end group: ditto
|
||||
|page # @page: ditto
|
||||
|node # @node: useful only in .info file
|
||||
|(?:end\s+)?ifnottex # @ifnottex .. @end ifnottex: use contents
|
||||
)\b/x and next;
|
||||
|
||||
chomp;
|
||||
|
||||
# Look for filename and title markers.
|
||||
/^\@setfilename\s+([^.]+)/ and $fn = $1, next;
|
||||
/^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next;
|
||||
|
||||
# Identify a man title but keep only the one we are interested in.
|
||||
/^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do {
|
||||
if (exists $defs{$1}) {
|
||||
$fn = $1;
|
||||
$tl = postprocess($2);
|
||||
}
|
||||
next;
|
||||
};
|
||||
|
||||
# Look for blocks surrounded by @c man begin SECTION ... @c man end.
|
||||
# This really oughta be @ifman ... @end ifman and the like, but such
|
||||
# would require rev'ing all other Texinfo translators.
|
||||
/^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do {
|
||||
$output = 1 if exists $defs{$2};
|
||||
$sect = $1;
|
||||
next;
|
||||
};
|
||||
/^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next;
|
||||
/^\@c\s+man\s+end/ and do {
|
||||
$sects{$sect} = "" unless exists $sects{$sect};
|
||||
$sects{$sect} .= postprocess($section);
|
||||
$section = "";
|
||||
$output = 0;
|
||||
next;
|
||||
};
|
||||
|
||||
# handle variables
|
||||
/^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do {
|
||||
$defs{$1} = $2;
|
||||
next;
|
||||
};
|
||||
/^\@clear\s+([a-zA-Z0-9_-]+)/ and do {
|
||||
delete $defs{$1};
|
||||
next;
|
||||
};
|
||||
|
||||
next unless $output;
|
||||
|
||||
# Discard comments. (Can't do it above, because then we'd never see
|
||||
# @c man lines.)
|
||||
/^\@c\b/ and next;
|
||||
|
||||
# End-block handler goes up here because it needs to operate even
|
||||
# if we are skipping.
|
||||
/^\@end\s+([a-z]+)/ and do {
|
||||
# Ignore @end foo, where foo is not an operation which may
|
||||
# cause us to skip, if we are presently skipping.
|
||||
my $ended = $1;
|
||||
next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex)$/;
|
||||
|
||||
die "\@end $ended without \@$ended at line $.\n" unless defined $endw;
|
||||
die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw;
|
||||
|
||||
$endw = pop @endwstack;
|
||||
|
||||
if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) {
|
||||
$skipping = pop @skstack;
|
||||
next;
|
||||
} elsif ($ended =~ /^(?:example|smallexample|display)$/) {
|
||||
$shift = "";
|
||||
$_ = ""; # need a paragraph break
|
||||
} elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
|
||||
$_ = "\n=back\n";
|
||||
$ic = pop @icstack;
|
||||
} else {
|
||||
die "unknown command \@end $ended at line $.\n";
|
||||
}
|
||||
};
|
||||
|
||||
# We must handle commands which can cause skipping even while we
|
||||
# are skipping, otherwise we will not process nested conditionals
|
||||
# correctly.
|
||||
/^\@ifset\s+([a-zA-Z0-9_-]+)/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @skstack, $skipping;
|
||||
$endw = "ifset";
|
||||
$skipping = 1 unless exists $defs{$1};
|
||||
next;
|
||||
};
|
||||
|
||||
/^\@ifclear\s+([a-zA-Z0-9_-]+)/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @skstack, $skipping;
|
||||
$endw = "ifclear";
|
||||
$skipping = 1 if exists $defs{$1};
|
||||
next;
|
||||
};
|
||||
|
||||
/^\@(ignore|menu|iftex)\b/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @skstack, $skipping;
|
||||
$endw = $1;
|
||||
$skipping = 1;
|
||||
next;
|
||||
};
|
||||
|
||||
next if $skipping;
|
||||
|
||||
# Character entities. First the ones that can be replaced by raw text
|
||||
# or discarded outright:
|
||||
s/\@copyright\{\}/(c)/g;
|
||||
s/\@dots\{\}/.../g;
|
||||
s/\@enddots\{\}/..../g;
|
||||
s/\@([.!? ])/$1/g;
|
||||
s/\@[:-]//g;
|
||||
s/\@bullet(?:\{\})?/*/g;
|
||||
s/\@TeX\{\}/TeX/g;
|
||||
s/\@pounds\{\}/\#/g;
|
||||
s/\@minus(?:\{\})?/-/g;
|
||||
s/\\,/,/g;
|
||||
|
||||
# Now the ones that have to be replaced by special escapes
|
||||
# (which will be turned back into text by unmunge())
|
||||
s/&/&/g;
|
||||
s/\@\{/{/g;
|
||||
s/\@\}/}/g;
|
||||
s/\@\@/&at;/g;
|
||||
|
||||
# Inside a verbatim block, handle @var specially.
|
||||
if ($shift ne "") {
|
||||
s/\@var\{([^\}]*)\}/<$1>/g;
|
||||
}
|
||||
|
||||
# POD doesn't interpret E<> inside a verbatim block.
|
||||
if ($shift eq "") {
|
||||
s/</</g;
|
||||
s/>/>/g;
|
||||
} else {
|
||||
s/</</g;
|
||||
s/>/>/g;
|
||||
}
|
||||
|
||||
# Single line command handlers.
|
||||
|
||||
/^\@include\s+(.+)$/ and do {
|
||||
push @instack, $inf;
|
||||
$inf = gensym();
|
||||
|
||||
# Try cwd and $ibase.
|
||||
open($inf, "<" . $1)
|
||||
or open($inf, "<" . $ibase . "/" . $1)
|
||||
or die "cannot open $1 or $ibase/$1: $!\n";
|
||||
next;
|
||||
};
|
||||
|
||||
/^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/
|
||||
and $_ = "\n=head2 $1\n";
|
||||
/^\@subsection\s+(.+)$/
|
||||
and $_ = "\n=head3 $1\n";
|
||||
|
||||
# Block command handlers:
|
||||
/^\@itemize\s+(\@[a-z]+|\*|-)/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @icstack, $ic;
|
||||
$ic = $1;
|
||||
$_ = "\n=over 4\n";
|
||||
$endw = "itemize";
|
||||
};
|
||||
|
||||
/^\@enumerate(?:\s+([a-zA-Z0-9]+))?/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @icstack, $ic;
|
||||
if (defined $1) {
|
||||
$ic = $1 . ".";
|
||||
} else {
|
||||
$ic = "1.";
|
||||
}
|
||||
$_ = "\n=over 4\n";
|
||||
$endw = "enumerate";
|
||||
};
|
||||
|
||||
/^\@([fv]?table)\s+(\@[a-z]+)/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @icstack, $ic;
|
||||
$endw = $1;
|
||||
$ic = $2;
|
||||
$ic =~ s/\@(?:samp|strong|key|gcctabopt|option|env)/B/;
|
||||
$ic =~ s/\@(?:code|kbd)/C/;
|
||||
$ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
|
||||
$ic =~ s/\@(?:file)/F/;
|
||||
$_ = "\n=over 4\n";
|
||||
};
|
||||
|
||||
/^\@((?:small)?example|display)/ and do {
|
||||
push @endwstack, $endw;
|
||||
$endw = $1;
|
||||
$shift = "\t";
|
||||
$_ = ""; # need a paragraph break
|
||||
};
|
||||
|
||||
/^\@itemx?\s*(.+)?$/ and do {
|
||||
if (defined $1) {
|
||||
# Entity escapes prevent munging by the <> processing below.
|
||||
$_ = "\n=item $ic\<$1\>\n";
|
||||
} else {
|
||||
$_ = "\n=item $ic\n";
|
||||
$ic =~ y/A-Ya-y/B-Zb-z/;
|
||||
$ic =~ s/(\d+)/$1 + 1/eg;
|
||||
}
|
||||
};
|
||||
|
||||
$section .= $shift.$_."\n";
|
||||
}
|
||||
# End of current file.
|
||||
close($inf);
|
||||
$inf = pop @instack;
|
||||
}
|
||||
|
||||
die "No filename or title\n" unless defined $fn && defined $tl;
|
||||
|
||||
$sects{NAME} = "$fn \- $tl\n";
|
||||
$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
|
||||
|
||||
for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS EXAMPLES ENVIRONMENT FILES
|
||||
BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) {
|
||||
if(exists $sects{$sect}) {
|
||||
$head = $sect;
|
||||
$head =~ s/SEEALSO/SEE ALSO/;
|
||||
print "=head1 $head\n\n";
|
||||
print scalar unmunge ($sects{$sect});
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub usage
|
||||
{
|
||||
die "usage: $0 [-D toggle...] [infile [outfile]]\n";
|
||||
}
|
||||
|
||||
sub postprocess
|
||||
{
|
||||
local $_ = $_[0];
|
||||
|
||||
# @value{foo} is replaced by whatever 'foo' is defined as.
|
||||
while (m/(\@value\{([a-zA-Z0-9_-]+)\})/g) {
|
||||
if (! exists $defs{$2}) {
|
||||
print STDERR "Option $2 not defined\n";
|
||||
s/\Q$1\E//;
|
||||
} else {
|
||||
$value = $defs{$2};
|
||||
s/\Q$1\E/$value/;
|
||||
}
|
||||
}
|
||||
|
||||
# Formatting commands.
|
||||
# Temporary escape for @r.
|
||||
s/\@r\{([^\}]*)\}/R<$1>/g;
|
||||
s/\@(?:dfn|var|emph|cite|i)\{([^\}]*)\}/I<$1>/g;
|
||||
s/\@(?:code|kbd)\{([^\}]*)\}/C<$1>/g;
|
||||
s/\@(?:gccoptlist|samp|strong|key|option|env|command|b)\{([^\}]*)\}/B<$1>/g;
|
||||
s/\@sc\{([^\}]*)\}/\U$1/g;
|
||||
s/\@file\{([^\}]*)\}/F<$1>/g;
|
||||
s/\@w\{([^\}]*)\}/S<$1>/g;
|
||||
s/\@(?:dmn|math)\{([^\}]*)\}/$1/g;
|
||||
|
||||
# Cross references are thrown away, as are @noindent and @refill.
|
||||
# (@noindent is impossible in .pod, and @refill is unnecessary.)
|
||||
# @* is also impossible in .pod; we discard it and any newline that
|
||||
# follows it. Similarly, our macro @gol must be discarded.
|
||||
|
||||
s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g;
|
||||
s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g;
|
||||
s/;\s+\@pxref\{(?:[^\}]*)\}//g;
|
||||
s/\@noindent\s*//g;
|
||||
s/\@refill//g;
|
||||
s/\@gol//g;
|
||||
s/\@\*\s*\n?//g;
|
||||
|
||||
# @uref can take one, two, or three arguments, with different
|
||||
# semantics each time. @url and @email are just like @uref with
|
||||
# one argument, for our purposes.
|
||||
s/\@(?:uref|url|email)\{([^\},]*)\}/<B<$1>>/g;
|
||||
s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g;
|
||||
s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g;
|
||||
|
||||
# Turn B<blah I<blah> blah> into B<blah> I<blah> B<blah> to
|
||||
# match Texinfo semantics of @emph inside @samp. Also handle @r
|
||||
# inside bold.
|
||||
s/</</g;
|
||||
s/>/>/g;
|
||||
1 while s/B<((?:[^<>]|I<[^<>]*>)*)R<([^>]*)>/B<$1>${2}B</g;
|
||||
1 while (s/B<([^<>]*)I<([^>]+)>/B<$1>I<$2>B</g);
|
||||
1 while (s/I<([^<>]*)B<([^>]+)>/I<$1>B<$2>I</g);
|
||||
s/[BI]<>//g;
|
||||
s/([BI])<(\s+)([^>]+)>/$2$1<$3>/g;
|
||||
s/([BI])<([^>]+?)(\s+)>/$1<$2>$3/g;
|
||||
|
||||
# Extract footnotes. This has to be done after all other
|
||||
# processing because otherwise the regexp will choke on formatting
|
||||
# inside @footnote.
|
||||
while (/\@footnote/g) {
|
||||
s/\@footnote\{([^\}]+)\}/[$fnno]/;
|
||||
add_footnote($1, $fnno);
|
||||
$fnno++;
|
||||
}
|
||||
|
||||
return $_;
|
||||
}
|
||||
|
||||
sub unmunge
|
||||
{
|
||||
# Replace escaped symbols with their equivalents.
|
||||
local $_ = $_[0];
|
||||
|
||||
s/</E<lt>/g;
|
||||
s/>/E<gt>/g;
|
||||
s/{/\{/g;
|
||||
s/}/\}/g;
|
||||
s/&at;/\@/g;
|
||||
s/&/&/g;
|
||||
return $_;
|
||||
}
|
||||
|
||||
sub add_footnote
|
||||
{
|
||||
unless (exists $sects{FOOTNOTES}) {
|
||||
$sects{FOOTNOTES} = "\n=over 4\n\n";
|
||||
}
|
||||
|
||||
$sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++;
|
||||
$sects{FOOTNOTES} .= $_[0];
|
||||
$sects{FOOTNOTES} .= "\n\n";
|
||||
}
|
||||
|
||||
# stolen from Symbol.pm
|
||||
{
|
||||
my $genseq = 0;
|
||||
sub gensym
|
||||
{
|
||||
my $name = "GEN" . $genseq++;
|
||||
my $ref = \*{$name};
|
||||
delete $::{$name};
|
||||
return $ref;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
coder=0
|
||||
bf=0
|
||||
flags2=-wpred-dct8x8+mbtree
|
||||
wpredp=0
|
||||
@@ -1,22 +0,0 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
cmp=+chroma
|
||||
partitions=+parti8x8+parti4x4+partp8x8+partb8x8
|
||||
me_method=hex
|
||||
subq=7
|
||||
me_range=16
|
||||
g=250
|
||||
keyint_min=25
|
||||
sc_threshold=40
|
||||
i_qfactor=0.71
|
||||
b_strategy=1
|
||||
qcomp=0.6
|
||||
qmin=10
|
||||
qmax=51
|
||||
qdiff=4
|
||||
bf=3
|
||||
refs=3
|
||||
directpred=1
|
||||
trellis=1
|
||||
flags2=+mixed_refs+wpred+dct8x8+fastpskip+mbtree
|
||||
wpredp=2
|
||||
@@ -1,22 +0,0 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
cmp=+chroma
|
||||
partitions=-parti8x8-parti4x4-partp8x8-partp4x4-partb8x8
|
||||
me_method=dia
|
||||
subq=2
|
||||
me_range=16
|
||||
g=250
|
||||
keyint_min=25
|
||||
sc_threshold=40
|
||||
i_qfactor=0.71
|
||||
b_strategy=1
|
||||
qcomp=0.6
|
||||
qmin=10
|
||||
qmax=51
|
||||
qdiff=4
|
||||
bf=3
|
||||
refs=1
|
||||
directpred=3
|
||||
trellis=0
|
||||
flags2=-bpyramid-wpred-mixed_refs-dct8x8+fastpskip+mbtree
|
||||
wpredp=2
|
||||
@@ -1,22 +0,0 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
cmp=+chroma
|
||||
partitions=+parti8x8+parti4x4+partp8x8+partb8x8
|
||||
me_method=umh
|
||||
subq=8
|
||||
me_range=16
|
||||
g=250
|
||||
keyint_min=25
|
||||
sc_threshold=40
|
||||
i_qfactor=0.71
|
||||
b_strategy=2
|
||||
qcomp=0.6
|
||||
qmin=10
|
||||
qmax=51
|
||||
qdiff=4
|
||||
bf=3
|
||||
refs=4
|
||||
directpred=3
|
||||
trellis=1
|
||||
flags2=+wpred+mixed_refs+dct8x8+fastpskip+mbtree
|
||||
wpredp=2
|
||||
@@ -1,7 +0,0 @@
|
||||
coder=0
|
||||
bf=0
|
||||
flags2=-wpred-dct8x8+mbtree
|
||||
level=13
|
||||
maxrate=768000
|
||||
bufsize=3000000
|
||||
wpredp=0
|
||||
@@ -1,8 +0,0 @@
|
||||
coder=0
|
||||
bf=0
|
||||
refs=1
|
||||
flags2=-wpred-dct8x8+mbtree
|
||||
level=30
|
||||
maxrate=10000000
|
||||
bufsize=10000000
|
||||
wpredp=0
|
||||
@@ -1,20 +0,0 @@
|
||||
coder=0
|
||||
flags=+loop
|
||||
cmp=+chroma
|
||||
partitions=-parti8x8+parti4x4+partp8x8-partp4x4-partb8x8
|
||||
me_method=hex
|
||||
subq=3
|
||||
me_range=16
|
||||
g=250
|
||||
keyint_min=25
|
||||
sc_threshold=40
|
||||
i_qfactor=0.71
|
||||
b_strategy=1
|
||||
qcomp=0.6
|
||||
qmin=10
|
||||
qmax=51
|
||||
qdiff=4
|
||||
directpred=1
|
||||
flags2=+fastpskip+mbtree
|
||||
cqp=0
|
||||
wpredp=0
|
||||
@@ -1,21 +0,0 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
cmp=+chroma
|
||||
partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8
|
||||
me_method=esa
|
||||
subq=8
|
||||
me_range=16
|
||||
g=250
|
||||
keyint_min=25
|
||||
sc_threshold=40
|
||||
i_qfactor=0.71
|
||||
b_strategy=1
|
||||
qcomp=0.6
|
||||
qmin=10
|
||||
qmax=51
|
||||
qdiff=4
|
||||
refs=16
|
||||
directpred=1
|
||||
flags2=+mixed_refs+dct8x8+fastpskip+mbtree
|
||||
cqp=0
|
||||
wpredp=2
|
||||
@@ -1,20 +0,0 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
cmp=+chroma
|
||||
partitions=-parti8x8+parti4x4+partp8x8+partp4x4-partb8x8
|
||||
me_method=hex
|
||||
subq=5
|
||||
me_range=16
|
||||
g=250
|
||||
keyint_min=25
|
||||
sc_threshold=40
|
||||
i_qfactor=0.71
|
||||
b_strategy=1
|
||||
qcomp=0.6
|
||||
qmin=10
|
||||
qmax=51
|
||||
qdiff=4
|
||||
directpred=1
|
||||
flags2=+fastpskip+mbtree
|
||||
cqp=0
|
||||
wpredp=2
|
||||
@@ -1,21 +0,0 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
cmp=+chroma
|
||||
partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8
|
||||
me_method=umh
|
||||
subq=6
|
||||
me_range=16
|
||||
g=250
|
||||
keyint_min=25
|
||||
sc_threshold=40
|
||||
i_qfactor=0.71
|
||||
b_strategy=1
|
||||
qcomp=0.6
|
||||
qmin=10
|
||||
qmax=51
|
||||
qdiff=4
|
||||
refs=2
|
||||
directpred=1
|
||||
flags2=+dct8x8+fastpskip+mbtree
|
||||
cqp=0
|
||||
wpredp=2
|
||||
@@ -1,21 +0,0 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
cmp=+chroma
|
||||
partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8
|
||||
me_method=umh
|
||||
subq=8
|
||||
me_range=16
|
||||
g=250
|
||||
keyint_min=25
|
||||
sc_threshold=40
|
||||
i_qfactor=0.71
|
||||
b_strategy=1
|
||||
qcomp=0.6
|
||||
qmin=10
|
||||
qmax=51
|
||||
qdiff=4
|
||||
refs=4
|
||||
directpred=1
|
||||
flags2=+mixed_refs+dct8x8+fastpskip+mbtree
|
||||
cqp=0
|
||||
wpredp=2
|
||||
@@ -1,19 +0,0 @@
|
||||
coder=0
|
||||
flags=+loop
|
||||
cmp=+chroma
|
||||
partitions=-parti8x8-parti4x4-partp8x8-partp4x4-partb8x8
|
||||
me_method=dia
|
||||
subq=0
|
||||
me_range=16
|
||||
g=250
|
||||
keyint_min=25
|
||||
sc_threshold=40
|
||||
i_qfactor=0.71
|
||||
b_strategy=1
|
||||
qcomp=0.6
|
||||
qmin=10
|
||||
qmax=51
|
||||
qdiff=4
|
||||
directpred=1
|
||||
flags2=+fastpskip+mbtree
|
||||
cqp=0
|
||||
@@ -1 +0,0 @@
|
||||
flags2=-dct8x8+mbtree
|
||||
@@ -1,22 +0,0 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
cmp=+chroma
|
||||
partitions=+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8
|
||||
me_method=tesa
|
||||
subq=10
|
||||
me_range=24
|
||||
g=250
|
||||
keyint_min=25
|
||||
sc_threshold=40
|
||||
i_qfactor=0.71
|
||||
b_strategy=2
|
||||
qcomp=0.6
|
||||
qmin=10
|
||||
qmax=51
|
||||
qdiff=4
|
||||
bf=3
|
||||
refs=16
|
||||
directpred=3
|
||||
trellis=2
|
||||
flags2=+wpred+mixed_refs+dct8x8-fastpskip+mbtree
|
||||
wpredp=2
|
||||
@@ -1,22 +0,0 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
cmp=+chroma
|
||||
partitions=+parti8x8+parti4x4+partp8x8+partb8x8
|
||||
me_method=hex
|
||||
subq=6
|
||||
me_range=16
|
||||
g=250
|
||||
keyint_min=25
|
||||
sc_threshold=40
|
||||
i_qfactor=0.71
|
||||
b_strategy=1
|
||||
qcomp=0.6
|
||||
qmin=10
|
||||
qmax=51
|
||||
qdiff=4
|
||||
bf=3
|
||||
refs=2
|
||||
directpred=3
|
||||
trellis=0
|
||||
flags2=+wpred+dct8x8+fastpskip+mbtree
|
||||
wpredp=2
|
||||
@@ -1,22 +0,0 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
cmp=+chroma
|
||||
partitions=+parti8x8+parti4x4+partp8x8+partb8x8
|
||||
me_method=hex
|
||||
subq=6
|
||||
me_range=16
|
||||
g=250
|
||||
keyint_min=25
|
||||
sc_threshold=40
|
||||
i_qfactor=0.71
|
||||
b_strategy=2
|
||||
qcomp=0.6
|
||||
qmin=10
|
||||
qmax=51
|
||||
qdiff=4
|
||||
bf=3
|
||||
refs=1
|
||||
directpred=3
|
||||
trellis=0
|
||||
flags2=+wpred+dct8x8+fastpskip+mbtree
|
||||
wpredp=2
|
||||
-4555
File diff suppressed because it is too large
Load Diff
-28
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Multiple format streaming server
|
||||
* copyright (c) 2002 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#ifndef FFMPEG_FFSERVER_H
|
||||
#define FFMPEG_FFSERVER_H
|
||||
|
||||
/* interface between ffserver and modules */
|
||||
|
||||
void ffserver_module_init(void);
|
||||
|
||||
#endif /* FFMPEG_FFSERVER_H */
|
||||
@@ -1,875 +0,0 @@
|
||||
/*
|
||||
* 4XM codec
|
||||
* Copyright (c) 2003 Michael Niedermayer
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/4xm.c
|
||||
* 4XM codec.
|
||||
*/
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
#include "bitstream.h"
|
||||
#include "bytestream.h"
|
||||
|
||||
//#undef NDEBUG
|
||||
//#include <assert.h>
|
||||
|
||||
#define BLOCK_TYPE_VLC_BITS 5
|
||||
#define ACDC_VLC_BITS 9
|
||||
|
||||
#define CFRAME_BUFFER_COUNT 100
|
||||
|
||||
static const uint8_t block_type_tab[2][4][8][2]={
|
||||
{
|
||||
{ //{8,4,2}x{8,4,2}
|
||||
{ 0,1}, { 2,2}, { 6,3}, {14,4}, {30,5}, {31,5}, { 0,0}
|
||||
},{ //{8,4}x1
|
||||
{ 0,1}, { 0,0}, { 2,2}, { 6,3}, {14,4}, {15,4}, { 0,0}
|
||||
},{ //1x{8,4}
|
||||
{ 0,1}, { 2,2}, { 0,0}, { 6,3}, {14,4}, {15,4}, { 0,0}
|
||||
},{ //1x2, 2x1
|
||||
{ 0,1}, { 0,0}, { 0,0}, { 2,2}, { 6,3}, {14,4}, {15,4}
|
||||
}
|
||||
},{
|
||||
{ //{8,4,2}x{8,4,2}
|
||||
{ 1,2}, { 4,3}, { 5,3}, {0,2}, {6,3}, {7,3}, {0,0}
|
||||
},{//{8,4}x1
|
||||
{ 1,2}, { 0,0}, { 2,2}, {0,2}, {6,3}, {7,3}, {0,0}
|
||||
},{//1x{8,4}
|
||||
{ 1,2}, { 2,2}, { 0,0}, {0,2}, {6,3}, {7,3}, {0,0}
|
||||
},{//1x2, 2x1
|
||||
{ 1,2}, { 0,0}, { 0,0}, {0,2}, {2,2}, {6,3}, {7,3}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const uint8_t size2index[4][4]={
|
||||
{-1, 3, 1, 1},
|
||||
{ 3, 0, 0, 0},
|
||||
{ 2, 0, 0, 0},
|
||||
{ 2, 0, 0, 0},
|
||||
};
|
||||
|
||||
static const int8_t mv[256][2]={
|
||||
{ 0, 0},{ 0, -1},{ -1, 0},{ 1, 0},{ 0, 1},{ -1, -1},{ 1, -1},{ -1, 1},
|
||||
{ 1, 1},{ 0, -2},{ -2, 0},{ 2, 0},{ 0, 2},{ -1, -2},{ 1, -2},{ -2, -1},
|
||||
{ 2, -1},{ -2, 1},{ 2, 1},{ -1, 2},{ 1, 2},{ -2, -2},{ 2, -2},{ -2, 2},
|
||||
{ 2, 2},{ 0, -3},{ -3, 0},{ 3, 0},{ 0, 3},{ -1, -3},{ 1, -3},{ -3, -1},
|
||||
{ 3, -1},{ -3, 1},{ 3, 1},{ -1, 3},{ 1, 3},{ -2, -3},{ 2, -3},{ -3, -2},
|
||||
{ 3, -2},{ -3, 2},{ 3, 2},{ -2, 3},{ 2, 3},{ 0, -4},{ -4, 0},{ 4, 0},
|
||||
{ 0, 4},{ -1, -4},{ 1, -4},{ -4, -1},{ 4, -1},{ 4, 1},{ -1, 4},{ 1, 4},
|
||||
{ -3, -3},{ -3, 3},{ 3, 3},{ -2, -4},{ -4, -2},{ 4, -2},{ -4, 2},{ -2, 4},
|
||||
{ 2, 4},{ -3, -4},{ 3, -4},{ 4, -3},{ -5, 0},{ -4, 3},{ -3, 4},{ 3, 4},
|
||||
{ -1, -5},{ -5, -1},{ -5, 1},{ -1, 5},{ -2, -5},{ 2, -5},{ 5, -2},{ 5, 2},
|
||||
{ -4, -4},{ -4, 4},{ -3, -5},{ -5, -3},{ -5, 3},{ 3, 5},{ -6, 0},{ 0, 6},
|
||||
{ -6, -1},{ -6, 1},{ 1, 6},{ 2, -6},{ -6, 2},{ 2, 6},{ -5, -4},{ 5, 4},
|
||||
{ 4, 5},{ -6, -3},{ 6, 3},{ -7, 0},{ -1, -7},{ 5, -5},{ -7, 1},{ -1, 7},
|
||||
{ 4, -6},{ 6, 4},{ -2, -7},{ -7, 2},{ -3, -7},{ 7, -3},{ 3, 7},{ 6, -5},
|
||||
{ 0, -8},{ -1, -8},{ -7, -4},{ -8, 1},{ 4, 7},{ 2, -8},{ -2, 8},{ 6, 6},
|
||||
{ -8, 3},{ 5, -7},{ -5, 7},{ 8, -4},{ 0, -9},{ -9, -1},{ 1, 9},{ 7, -6},
|
||||
{ -7, 6},{ -5, -8},{ -5, 8},{ -9, 3},{ 9, -4},{ 7, -7},{ 8, -6},{ 6, 8},
|
||||
{ 10, 1},{-10, 2},{ 9, -5},{ 10, -3},{ -8, -7},{-10, -4},{ 6, -9},{-11, 0},
|
||||
{ 11, 1},{-11, -2},{ -2, 11},{ 7, -9},{ -7, 9},{ 10, 6},{ -4, 11},{ 8, -9},
|
||||
{ 8, 9},{ 5, 11},{ 7,-10},{ 12, -3},{ 11, 6},{ -9, -9},{ 8, 10},{ 5, 12},
|
||||
{-11, 7},{ 13, 2},{ 6,-12},{ 10, 9},{-11, 8},{ -7, 12},{ 0, 14},{ 14, -2},
|
||||
{ -9, 11},{ -6, 13},{-14, -4},{ -5,-14},{ 5, 14},{-15, -1},{-14, -6},{ 3,-15},
|
||||
{ 11,-11},{ -7, 14},{ -5, 15},{ 8,-14},{ 15, 6},{ 3, 16},{ 7,-15},{-16, 5},
|
||||
{ 0, 17},{-16, -6},{-10, 14},{-16, 7},{ 12, 13},{-16, 8},{-17, 6},{-18, 3},
|
||||
{ -7, 17},{ 15, 11},{ 16, 10},{ 2,-19},{ 3,-19},{-11,-16},{-18, 8},{-19, -6},
|
||||
{ 2,-20},{-17,-11},{-10,-18},{ 8, 19},{-21, -1},{-20, 7},{ -4, 21},{ 21, 5},
|
||||
{ 15, 16},{ 2,-22},{-10,-20},{-22, 5},{ 20,-11},{ -7,-22},{-12, 20},{ 23, -5},
|
||||
{ 13,-20},{ 24, -2},{-15, 19},{-11, 22},{ 16, 19},{ 23,-10},{-18,-18},{ -9,-24},
|
||||
{ 24,-10},{ -3, 26},{-23, 13},{-18,-20},{ 17, 21},{ -4, 27},{ 27, 6},{ 1,-28},
|
||||
{-11, 26},{-17,-23},{ 7, 28},{ 11,-27},{ 29, 5},{-23,-19},{-28,-11},{-21, 22},
|
||||
{-30, 7},{-17, 26},{-27, 16},{ 13, 29},{ 19,-26},{ 10,-31},{-14,-30},{ 20,-27},
|
||||
{-29, 18},{-16,-31},{-28,-22},{ 21,-30},{-25, 28},{ 26,-29},{ 25,-32},{-32,-32}
|
||||
};
|
||||
|
||||
// this is simply the scaled down elementwise product of the standard jpeg quantizer table and the AAN premul table
|
||||
static const uint8_t dequant_table[64]={
|
||||
16, 15, 13, 19, 24, 31, 28, 17,
|
||||
17, 23, 25, 31, 36, 63, 45, 21,
|
||||
18, 24, 27, 37, 52, 59, 49, 20,
|
||||
16, 28, 34, 40, 60, 80, 51, 20,
|
||||
18, 31, 48, 66, 68, 86, 56, 21,
|
||||
19, 38, 56, 59, 64, 64, 48, 20,
|
||||
27, 48, 55, 55, 56, 51, 35, 15,
|
||||
20, 35, 34, 32, 31, 22, 15, 8,
|
||||
};
|
||||
|
||||
static VLC block_type_vlc[2][4];
|
||||
|
||||
|
||||
typedef struct CFrameBuffer{
|
||||
unsigned int allocated_size;
|
||||
unsigned int size;
|
||||
int id;
|
||||
uint8_t *data;
|
||||
}CFrameBuffer;
|
||||
|
||||
typedef struct FourXContext{
|
||||
AVCodecContext *avctx;
|
||||
DSPContext dsp;
|
||||
AVFrame current_picture, last_picture;
|
||||
GetBitContext pre_gb; ///< ac/dc prefix
|
||||
GetBitContext gb;
|
||||
const uint8_t *bytestream;
|
||||
const uint8_t *bytestream_end;
|
||||
const uint16_t *wordstream;
|
||||
const uint16_t *wordstream_end;
|
||||
int mv[256];
|
||||
VLC pre_vlc;
|
||||
int last_dc;
|
||||
DECLARE_ALIGNED_8(DCTELEM, block[6][64]);
|
||||
uint8_t *bitstream_buffer;
|
||||
unsigned int bitstream_buffer_size;
|
||||
int version;
|
||||
CFrameBuffer cfrm[CFRAME_BUFFER_COUNT];
|
||||
} FourXContext;
|
||||
|
||||
|
||||
#define FIX_1_082392200 70936
|
||||
#define FIX_1_414213562 92682
|
||||
#define FIX_1_847759065 121095
|
||||
#define FIX_2_613125930 171254
|
||||
|
||||
#define MULTIPLY(var,const) (((var)*(const)) >> 16)
|
||||
|
||||
static void idct(DCTELEM block[64]){
|
||||
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
|
||||
int tmp10, tmp11, tmp12, tmp13;
|
||||
int z5, z10, z11, z12, z13;
|
||||
int i;
|
||||
int temp[64];
|
||||
|
||||
for(i=0; i<8; i++){
|
||||
tmp10 = block[8*0 + i] + block[8*4 + i];
|
||||
tmp11 = block[8*0 + i] - block[8*4 + i];
|
||||
|
||||
tmp13 = block[8*2 + i] + block[8*6 + i];
|
||||
tmp12 = MULTIPLY(block[8*2 + i] - block[8*6 + i], FIX_1_414213562) - tmp13;
|
||||
|
||||
tmp0 = tmp10 + tmp13;
|
||||
tmp3 = tmp10 - tmp13;
|
||||
tmp1 = tmp11 + tmp12;
|
||||
tmp2 = tmp11 - tmp12;
|
||||
|
||||
z13 = block[8*5 + i] + block[8*3 + i];
|
||||
z10 = block[8*5 + i] - block[8*3 + i];
|
||||
z11 = block[8*1 + i] + block[8*7 + i];
|
||||
z12 = block[8*1 + i] - block[8*7 + i];
|
||||
|
||||
tmp7 = z11 + z13;
|
||||
tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562);
|
||||
|
||||
z5 = MULTIPLY(z10 + z12, FIX_1_847759065);
|
||||
tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
|
||||
tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5;
|
||||
|
||||
tmp6 = tmp12 - tmp7;
|
||||
tmp5 = tmp11 - tmp6;
|
||||
tmp4 = tmp10 + tmp5;
|
||||
|
||||
temp[8*0 + i] = tmp0 + tmp7;
|
||||
temp[8*7 + i] = tmp0 - tmp7;
|
||||
temp[8*1 + i] = tmp1 + tmp6;
|
||||
temp[8*6 + i] = tmp1 - tmp6;
|
||||
temp[8*2 + i] = tmp2 + tmp5;
|
||||
temp[8*5 + i] = tmp2 - tmp5;
|
||||
temp[8*4 + i] = tmp3 + tmp4;
|
||||
temp[8*3 + i] = tmp3 - tmp4;
|
||||
}
|
||||
|
||||
for(i=0; i<8*8; i+=8){
|
||||
tmp10 = temp[0 + i] + temp[4 + i];
|
||||
tmp11 = temp[0 + i] - temp[4 + i];
|
||||
|
||||
tmp13 = temp[2 + i] + temp[6 + i];
|
||||
tmp12 = MULTIPLY(temp[2 + i] - temp[6 + i], FIX_1_414213562) - tmp13;
|
||||
|
||||
tmp0 = tmp10 + tmp13;
|
||||
tmp3 = tmp10 - tmp13;
|
||||
tmp1 = tmp11 + tmp12;
|
||||
tmp2 = tmp11 - tmp12;
|
||||
|
||||
z13 = temp[5 + i] + temp[3 + i];
|
||||
z10 = temp[5 + i] - temp[3 + i];
|
||||
z11 = temp[1 + i] + temp[7 + i];
|
||||
z12 = temp[1 + i] - temp[7 + i];
|
||||
|
||||
tmp7 = z11 + z13;
|
||||
tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562);
|
||||
|
||||
z5 = MULTIPLY(z10 + z12, FIX_1_847759065);
|
||||
tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
|
||||
tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5;
|
||||
|
||||
tmp6 = tmp12 - tmp7;
|
||||
tmp5 = tmp11 - tmp6;
|
||||
tmp4 = tmp10 + tmp5;
|
||||
|
||||
block[0 + i] = (tmp0 + tmp7)>>6;
|
||||
block[7 + i] = (tmp0 - tmp7)>>6;
|
||||
block[1 + i] = (tmp1 + tmp6)>>6;
|
||||
block[6 + i] = (tmp1 - tmp6)>>6;
|
||||
block[2 + i] = (tmp2 + tmp5)>>6;
|
||||
block[5 + i] = (tmp2 - tmp5)>>6;
|
||||
block[4 + i] = (tmp3 + tmp4)>>6;
|
||||
block[3 + i] = (tmp3 - tmp4)>>6;
|
||||
}
|
||||
}
|
||||
|
||||
static av_cold void init_vlcs(FourXContext *f){
|
||||
int i;
|
||||
|
||||
for(i=0; i<8; i++){
|
||||
init_vlc(&block_type_vlc[0][i], BLOCK_TYPE_VLC_BITS, 7,
|
||||
&block_type_tab[0][i][0][1], 2, 1,
|
||||
&block_type_tab[0][i][0][0], 2, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_mv(FourXContext *f){
|
||||
int i;
|
||||
|
||||
for(i=0; i<256; i++){
|
||||
if(f->version>1)
|
||||
f->mv[i] = mv[i][0] + mv[i][1] *f->current_picture.linesize[0]/2;
|
||||
else
|
||||
f->mv[i] = (i&15) - 8 + ((i>>4)-8)*f->current_picture.linesize[0]/2;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void mcdc(uint16_t *dst, uint16_t *src, int log2w, int h, int stride, int scale, int dc){
|
||||
int i;
|
||||
dc*= 0x10001;
|
||||
|
||||
switch(log2w){
|
||||
case 0:
|
||||
for(i=0; i<h; i++){
|
||||
dst[0] = scale*src[0] + dc;
|
||||
if(scale) src += stride;
|
||||
dst += stride;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
for(i=0; i<h; i++){
|
||||
((uint32_t*)dst)[0] = scale*((uint32_t*)src)[0] + dc;
|
||||
if(scale) src += stride;
|
||||
dst += stride;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for(i=0; i<h; i++){
|
||||
((uint32_t*)dst)[0] = scale*((uint32_t*)src)[0] + dc;
|
||||
((uint32_t*)dst)[1] = scale*((uint32_t*)src)[1] + dc;
|
||||
if(scale) src += stride;
|
||||
dst += stride;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for(i=0; i<h; i++){
|
||||
((uint32_t*)dst)[0] = scale*((uint32_t*)src)[0] + dc;
|
||||
((uint32_t*)dst)[1] = scale*((uint32_t*)src)[1] + dc;
|
||||
((uint32_t*)dst)[2] = scale*((uint32_t*)src)[2] + dc;
|
||||
((uint32_t*)dst)[3] = scale*((uint32_t*)src)[3] + dc;
|
||||
if(scale) src += stride;
|
||||
dst += stride;
|
||||
}
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, int log2w, int log2h, int stride){
|
||||
const int index= size2index[log2h][log2w];
|
||||
const int h= 1<<log2h;
|
||||
int code= get_vlc2(&f->gb, block_type_vlc[1-(f->version>1)][index].table, BLOCK_TYPE_VLC_BITS, 1);
|
||||
uint16_t *start= (uint16_t*)f->last_picture.data[0];
|
||||
uint16_t *end= start + stride*(f->avctx->height-h+1) - (1<<log2w);
|
||||
|
||||
assert(code>=0 && code<=6);
|
||||
|
||||
if(code == 0){
|
||||
if (f->bytestream_end - f->bytestream < 1)
|
||||
return;
|
||||
src += f->mv[ *f->bytestream++ ];
|
||||
if(start > src || src > end){
|
||||
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
|
||||
return;
|
||||
}
|
||||
mcdc(dst, src, log2w, h, stride, 1, 0);
|
||||
}else if(code == 1){
|
||||
log2h--;
|
||||
decode_p_block(f, dst , src , log2w, log2h, stride);
|
||||
decode_p_block(f, dst + (stride<<log2h), src + (stride<<log2h), log2w, log2h, stride);
|
||||
}else if(code == 2){
|
||||
log2w--;
|
||||
decode_p_block(f, dst , src , log2w, log2h, stride);
|
||||
decode_p_block(f, dst + (1<<log2w), src + (1<<log2w), log2w, log2h, stride);
|
||||
}else if(code == 3 && f->version<2){
|
||||
mcdc(dst, src, log2w, h, stride, 1, 0);
|
||||
}else if(code == 4){
|
||||
if (f->bytestream_end - f->bytestream < 1)
|
||||
return;
|
||||
src += f->mv[ *f->bytestream++ ];
|
||||
if(start > src || src > end){
|
||||
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
|
||||
return;
|
||||
}
|
||||
if (f->wordstream_end - f->wordstream < 1)
|
||||
return;
|
||||
mcdc(dst, src, log2w, h, stride, 1, le2me_16(*f->wordstream++));
|
||||
}else if(code == 5){
|
||||
if (f->wordstream_end - f->wordstream < 1)
|
||||
return;
|
||||
mcdc(dst, src, log2w, h, stride, 0, le2me_16(*f->wordstream++));
|
||||
}else if(code == 6){
|
||||
if (f->wordstream_end - f->wordstream < 2)
|
||||
return;
|
||||
if(log2w){
|
||||
dst[0] = le2me_16(*f->wordstream++);
|
||||
dst[1] = le2me_16(*f->wordstream++);
|
||||
}else{
|
||||
dst[0 ] = le2me_16(*f->wordstream++);
|
||||
dst[stride] = le2me_16(*f->wordstream++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length){
|
||||
int x, y;
|
||||
const int width= f->avctx->width;
|
||||
const int height= f->avctx->height;
|
||||
uint16_t *src= (uint16_t*)f->last_picture.data[0];
|
||||
uint16_t *dst= (uint16_t*)f->current_picture.data[0];
|
||||
const int stride= f->current_picture.linesize[0]>>1;
|
||||
unsigned int bitstream_size, bytestream_size, wordstream_size, extra;
|
||||
|
||||
if(f->version>1){
|
||||
extra=20;
|
||||
if (length < extra)
|
||||
return -1;
|
||||
bitstream_size= AV_RL32(buf+8);
|
||||
wordstream_size= AV_RL32(buf+12);
|
||||
bytestream_size= AV_RL32(buf+16);
|
||||
}else{
|
||||
extra=0;
|
||||
bitstream_size = AV_RL16(buf-4);
|
||||
wordstream_size= AV_RL16(buf-2);
|
||||
bytestream_size= FFMAX(length - bitstream_size - wordstream_size, 0);
|
||||
}
|
||||
|
||||
if (bitstream_size > length ||
|
||||
bytestream_size > length - bitstream_size ||
|
||||
wordstream_size > length - bytestream_size - bitstream_size ||
|
||||
extra > length - bytestream_size - bitstream_size - wordstream_size){
|
||||
av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size,
|
||||
bitstream_size+ bytestream_size+ wordstream_size - length);
|
||||
return -1;
|
||||
}
|
||||
|
||||
f->bitstream_buffer= av_fast_realloc(f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
f->dsp.bswap_buf((uint32_t*)f->bitstream_buffer, (const uint32_t*)(buf + extra), bitstream_size/4);
|
||||
init_get_bits(&f->gb, f->bitstream_buffer, 8*bitstream_size);
|
||||
|
||||
f->wordstream= (const uint16_t*)(buf + extra + bitstream_size);
|
||||
f->wordstream_end= f->wordstream + wordstream_size/2;
|
||||
f->bytestream= buf + extra + bitstream_size + wordstream_size;
|
||||
f->bytestream_end = f->bytestream + bytestream_size;
|
||||
|
||||
init_mv(f);
|
||||
|
||||
for(y=0; y<height; y+=8){
|
||||
for(x=0; x<width; x+=8){
|
||||
decode_p_block(f, dst + x, src + x, 3, 3, stride);
|
||||
}
|
||||
src += 8*stride;
|
||||
dst += 8*stride;
|
||||
}
|
||||
|
||||
if( bitstream_size != (get_bits_count(&f->gb)+31)/32*4
|
||||
|| (((const char*)f->wordstream - (const char*)buf + 2)&~2) != extra + bitstream_size + wordstream_size
|
||||
|| (((const char*)f->bytestream - (const char*)buf + 3)&~3) != extra + bitstream_size + wordstream_size + bytestream_size)
|
||||
av_log(f->avctx, AV_LOG_ERROR, " %d %td %td bytes left\n",
|
||||
bitstream_size - (get_bits_count(&f->gb)+31)/32*4,
|
||||
-(((const char*)f->bytestream - (const char*)buf + 3)&~3) + (extra + bitstream_size + wordstream_size + bytestream_size),
|
||||
-(((const char*)f->wordstream - (const char*)buf + 2)&~2) + (extra + bitstream_size + wordstream_size)
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* decode block and dequantize.
|
||||
* Note this is almost identical to MJPEG.
|
||||
*/
|
||||
static int decode_i_block(FourXContext *f, DCTELEM *block){
|
||||
int code, i, j, level, val;
|
||||
|
||||
/* DC coef */
|
||||
val = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3);
|
||||
if (val>>4){
|
||||
av_log(f->avctx, AV_LOG_ERROR, "error dc run != 0\n");
|
||||
}
|
||||
|
||||
if(val)
|
||||
val = get_xbits(&f->gb, val);
|
||||
|
||||
val = val * dequant_table[0] + f->last_dc;
|
||||
f->last_dc =
|
||||
block[0] = val;
|
||||
/* AC coefs */
|
||||
i = 1;
|
||||
for(;;) {
|
||||
code = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3);
|
||||
|
||||
/* EOB */
|
||||
if (code == 0)
|
||||
break;
|
||||
if (code == 0xf0) {
|
||||
i += 16;
|
||||
} else {
|
||||
level = get_xbits(&f->gb, code & 0xf);
|
||||
i += code >> 4;
|
||||
if (i >= 64) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "run %d oveflow\n", i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
j= ff_zigzag_direct[i];
|
||||
block[j] = level * dequant_table[j];
|
||||
i++;
|
||||
if (i >= 64)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void idct_put(FourXContext *f, int x, int y){
|
||||
DCTELEM (*block)[64]= f->block;
|
||||
int stride= f->current_picture.linesize[0]>>1;
|
||||
int i;
|
||||
uint16_t *dst = ((uint16_t*)f->current_picture.data[0]) + y * stride + x;
|
||||
|
||||
for(i=0; i<4; i++){
|
||||
block[i][0] += 0x80*8*8;
|
||||
idct(block[i]);
|
||||
}
|
||||
|
||||
if(!(f->avctx->flags&CODEC_FLAG_GRAY)){
|
||||
for(i=4; i<6; i++) idct(block[i]);
|
||||
}
|
||||
|
||||
/* Note transform is:
|
||||
y= ( 1b + 4g + 2r)/14
|
||||
cb=( 3b - 2g - 1r)/14
|
||||
cr=(-1b - 4g + 5r)/14
|
||||
*/
|
||||
for(y=0; y<8; y++){
|
||||
for(x=0; x<8; x++){
|
||||
DCTELEM *temp= block[(x>>2) + 2*(y>>2)] + 2*(x&3) + 2*8*(y&3); //FIXME optimize
|
||||
int cb= block[4][x + 8*y];
|
||||
int cr= block[5][x + 8*y];
|
||||
int cg= (cb + cr)>>1;
|
||||
int y;
|
||||
|
||||
cb+=cb;
|
||||
|
||||
y = temp[0];
|
||||
dst[0 ]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8);
|
||||
y = temp[1];
|
||||
dst[1 ]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8);
|
||||
y = temp[8];
|
||||
dst[ stride]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8);
|
||||
y = temp[9];
|
||||
dst[1+stride]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8);
|
||||
dst += 2;
|
||||
}
|
||||
dst += 2*stride - 2*8;
|
||||
}
|
||||
}
|
||||
|
||||
static int decode_i_mb(FourXContext *f){
|
||||
int i;
|
||||
|
||||
f->dsp.clear_blocks(f->block[0]);
|
||||
|
||||
for(i=0; i<6; i++){
|
||||
if(decode_i_block(f, f->block[i]) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const uint8_t *read_huffman_tables(FourXContext *f, const uint8_t * const buf, int buf_size){
|
||||
int frequency[512];
|
||||
uint8_t flag[512];
|
||||
int up[512];
|
||||
uint8_t len_tab[257];
|
||||
int bits_tab[257];
|
||||
int start, end;
|
||||
const uint8_t *ptr= buf;
|
||||
const uint8_t *ptr_end = buf + buf_size;
|
||||
int j;
|
||||
|
||||
memset(frequency, 0, sizeof(frequency));
|
||||
memset(up, -1, sizeof(up));
|
||||
|
||||
start= *ptr++;
|
||||
end= *ptr++;
|
||||
for(;;){
|
||||
int i;
|
||||
|
||||
if (start <= end && ptr_end - ptr < end - start + 1 + 1)
|
||||
return NULL;
|
||||
for(i=start; i<=end; i++){
|
||||
frequency[i]= *ptr++;
|
||||
}
|
||||
start= *ptr++;
|
||||
if(start==0) break;
|
||||
|
||||
end= *ptr++;
|
||||
}
|
||||
frequency[256]=1;
|
||||
|
||||
while((ptr - buf)&3) ptr++; // 4byte align
|
||||
|
||||
for(j=257; j<512; j++){
|
||||
int min_freq[2]= {256*256, 256*256};
|
||||
int smallest[2]= {0, 0};
|
||||
int i;
|
||||
for(i=0; i<j; i++){
|
||||
if(frequency[i] == 0) continue;
|
||||
if(frequency[i] < min_freq[1]){
|
||||
if(frequency[i] < min_freq[0]){
|
||||
min_freq[1]= min_freq[0]; smallest[1]= smallest[0];
|
||||
min_freq[0]= frequency[i];smallest[0]= i;
|
||||
}else{
|
||||
min_freq[1]= frequency[i];smallest[1]= i;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(min_freq[1] == 256*256) break;
|
||||
|
||||
frequency[j]= min_freq[0] + min_freq[1];
|
||||
flag[ smallest[0] ]= 0;
|
||||
flag[ smallest[1] ]= 1;
|
||||
up[ smallest[0] ]=
|
||||
up[ smallest[1] ]= j;
|
||||
frequency[ smallest[0] ]= frequency[ smallest[1] ]= 0;
|
||||
}
|
||||
|
||||
for(j=0; j<257; j++){
|
||||
int node;
|
||||
int len=0;
|
||||
int bits=0;
|
||||
|
||||
for(node= j; up[node] != -1; node= up[node]){
|
||||
bits += flag[node]<<len;
|
||||
len++;
|
||||
if(len > 31) av_log(f->avctx, AV_LOG_ERROR, "vlc length overflow\n"); //can this happen at all ?
|
||||
}
|
||||
|
||||
bits_tab[j]= bits;
|
||||
len_tab[j]= len;
|
||||
}
|
||||
|
||||
init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257,
|
||||
len_tab , 1, 1,
|
||||
bits_tab, 4, 4, 0);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static int mix(int c0, int c1){
|
||||
int blue = 2*(c0&0x001F) + (c1&0x001F);
|
||||
int green= (2*(c0&0x03E0) + (c1&0x03E0))>>5;
|
||||
int red = 2*(c0>>10) + (c1>>10);
|
||||
return red/3*1024 + green/3*32 + blue/3;
|
||||
}
|
||||
|
||||
static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length){
|
||||
int x, y, x2, y2;
|
||||
const int width= f->avctx->width;
|
||||
const int height= f->avctx->height;
|
||||
uint16_t *dst= (uint16_t*)f->current_picture.data[0];
|
||||
const int stride= f->current_picture.linesize[0]>>1;
|
||||
const uint8_t *buf_end = buf + length;
|
||||
|
||||
for(y=0; y<height; y+=16){
|
||||
for(x=0; x<width; x+=16){
|
||||
unsigned int color[4], bits;
|
||||
if (buf_end - buf < 8)
|
||||
return -1;
|
||||
memset(color, 0, sizeof(color));
|
||||
//warning following is purely guessed ...
|
||||
color[0]= bytestream_get_le16(&buf);
|
||||
color[1]= bytestream_get_le16(&buf);
|
||||
|
||||
if(color[0]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 1\n");
|
||||
if(color[1]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 2\n");
|
||||
|
||||
color[2]= mix(color[0], color[1]);
|
||||
color[3]= mix(color[1], color[0]);
|
||||
|
||||
bits= bytestream_get_le32(&buf);
|
||||
for(y2=0; y2<16; y2++){
|
||||
for(x2=0; x2<16; x2++){
|
||||
int index= 2*(x2>>2) + 8*(y2>>2);
|
||||
dst[y2*stride+x2]= color[(bits>>index)&3];
|
||||
}
|
||||
}
|
||||
dst+=16;
|
||||
}
|
||||
dst += 16*stride - width;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length){
|
||||
int x, y;
|
||||
const int width= f->avctx->width;
|
||||
const int height= f->avctx->height;
|
||||
uint16_t *dst= (uint16_t*)f->current_picture.data[0];
|
||||
const int stride= f->current_picture.linesize[0]>>1;
|
||||
const unsigned int bitstream_size= AV_RL32(buf);
|
||||
unsigned int prestream_size;
|
||||
const uint8_t *prestream;
|
||||
|
||||
if (bitstream_size > (1<<26) || length < bitstream_size + 12)
|
||||
return -1;
|
||||
prestream_size = 4*AV_RL32(buf + bitstream_size + 4);
|
||||
prestream = buf + bitstream_size + 12;
|
||||
|
||||
if (prestream_size > (1<<26) ||
|
||||
prestream_size != length - (bitstream_size + 12)){
|
||||
av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n", prestream_size, bitstream_size, length);
|
||||
return -1;
|
||||
}
|
||||
|
||||
prestream= read_huffman_tables(f, prestream, buf + length - prestream);
|
||||
if (!prestream)
|
||||
return -1;
|
||||
|
||||
init_get_bits(&f->gb, buf + 4, 8*bitstream_size);
|
||||
|
||||
prestream_size= length + buf - prestream;
|
||||
|
||||
f->bitstream_buffer= av_fast_realloc(f->bitstream_buffer, &f->bitstream_buffer_size, prestream_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
f->dsp.bswap_buf((uint32_t*)f->bitstream_buffer, (const uint32_t*)prestream, prestream_size/4);
|
||||
init_get_bits(&f->pre_gb, f->bitstream_buffer, 8*prestream_size);
|
||||
|
||||
f->last_dc= 0*128*8*8;
|
||||
|
||||
for(y=0; y<height; y+=16){
|
||||
for(x=0; x<width; x+=16){
|
||||
if(decode_i_mb(f) < 0)
|
||||
return -1;
|
||||
|
||||
idct_put(f, x, y);
|
||||
}
|
||||
dst += 16*stride;
|
||||
}
|
||||
|
||||
if(get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256)
|
||||
av_log(f->avctx, AV_LOG_ERROR, "end mismatch\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *data_size,
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
FourXContext * const f = avctx->priv_data;
|
||||
AVFrame *picture = data;
|
||||
AVFrame *p, temp;
|
||||
int i, frame_4cc, frame_size;
|
||||
|
||||
if (buf_size < 12)
|
||||
return AVERROR_INVALIDDATA;
|
||||
frame_4cc= AV_RL32(buf);
|
||||
if(buf_size != AV_RL32(buf+4)+8 || buf_size < 20){
|
||||
av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d\n", buf_size, AV_RL32(buf+4));
|
||||
}
|
||||
|
||||
if(frame_4cc == AV_RL32("cfrm")){
|
||||
int free_index=-1;
|
||||
const int data_size= buf_size - 20;
|
||||
const int id= AV_RL32(buf+12);
|
||||
const int whole_size= AV_RL32(buf+16);
|
||||
CFrameBuffer *cfrm;
|
||||
|
||||
if (data_size < 0 || whole_size < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for(i=0; i<CFRAME_BUFFER_COUNT; i++){
|
||||
if(f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number)
|
||||
av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", f->cfrm[i].id);
|
||||
}
|
||||
|
||||
for(i=0; i<CFRAME_BUFFER_COUNT; i++){
|
||||
if(f->cfrm[i].id == id) break;
|
||||
if(f->cfrm[i].size == 0 ) free_index= i;
|
||||
}
|
||||
|
||||
if(i>=CFRAME_BUFFER_COUNT){
|
||||
i= free_index;
|
||||
f->cfrm[i].id= id;
|
||||
}
|
||||
cfrm= &f->cfrm[i];
|
||||
|
||||
if (data_size > UINT_MAX - cfrm->size - FF_INPUT_BUFFER_PADDING_SIZE)
|
||||
return AVERROR_INVALIDDATA;
|
||||
cfrm->data= av_fast_realloc(cfrm->data, &cfrm->allocated_size, cfrm->size + data_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
if(!cfrm->data){ //explicit check needed as memcpy below might not catch a NULL
|
||||
av_log(f->avctx, AV_LOG_ERROR, "realloc falure");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(cfrm->data + cfrm->size, buf+20, data_size);
|
||||
cfrm->size += data_size;
|
||||
|
||||
if(cfrm->size >= whole_size){
|
||||
buf= cfrm->data;
|
||||
frame_size= cfrm->size;
|
||||
|
||||
if(id != avctx->frame_number){
|
||||
av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n", id, avctx->frame_number);
|
||||
}
|
||||
|
||||
cfrm->size= cfrm->id= 0;
|
||||
frame_4cc= AV_RL32("pfrm");
|
||||
}else
|
||||
return buf_size;
|
||||
}else{
|
||||
buf= buf + 12;
|
||||
frame_size= buf_size - 12;
|
||||
}
|
||||
|
||||
temp= f->current_picture;
|
||||
f->current_picture= f->last_picture;
|
||||
f->last_picture= temp;
|
||||
|
||||
p= &f->current_picture;
|
||||
avctx->coded_frame= p;
|
||||
|
||||
avctx->flags |= CODEC_FLAG_EMU_EDGE; // alternatively we would have to use our own buffer management
|
||||
|
||||
if(p->data[0])
|
||||
avctx->release_buffer(avctx, p);
|
||||
|
||||
p->reference= 1;
|
||||
if(avctx->get_buffer(avctx, p) < 0){
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(frame_4cc == AV_RL32("ifr2")){
|
||||
p->pict_type= FF_I_TYPE;
|
||||
if(decode_i2_frame(f, buf-4, frame_size) < 0)
|
||||
return -1;
|
||||
}else if(frame_4cc == AV_RL32("ifrm")){
|
||||
p->pict_type= FF_I_TYPE;
|
||||
if(decode_i_frame(f, buf, frame_size) < 0)
|
||||
return -1;
|
||||
}else if(frame_4cc == AV_RL32("pfrm") || frame_4cc == AV_RL32("pfr2")){
|
||||
p->pict_type= FF_P_TYPE;
|
||||
if(decode_p_frame(f, buf, frame_size) < 0)
|
||||
return -1;
|
||||
}else if(frame_4cc == AV_RL32("snd_")){
|
||||
av_log(avctx, AV_LOG_ERROR, "ignoring snd_ chunk length:%d\n", buf_size);
|
||||
}else{
|
||||
av_log(avctx, AV_LOG_ERROR, "ignoring unknown chunk length:%d\n", buf_size);
|
||||
}
|
||||
|
||||
p->key_frame= p->pict_type == FF_I_TYPE;
|
||||
|
||||
*picture= *p;
|
||||
*data_size = sizeof(AVPicture);
|
||||
|
||||
emms_c();
|
||||
|
||||
return buf_size;
|
||||
}
|
||||
|
||||
|
||||
static av_cold void common_init(AVCodecContext *avctx){
|
||||
FourXContext * const f = avctx->priv_data;
|
||||
|
||||
dsputil_init(&f->dsp, avctx);
|
||||
|
||||
f->avctx= avctx;
|
||||
}
|
||||
|
||||
static av_cold int decode_init(AVCodecContext *avctx){
|
||||
FourXContext * const f = avctx->priv_data;
|
||||
|
||||
if(avctx->extradata_size != 4 || !avctx->extradata) {
|
||||
av_log(avctx, AV_LOG_ERROR, "extradata wrong or missing\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
f->version= AV_RL32(avctx->extradata)>>16;
|
||||
common_init(avctx);
|
||||
init_vlcs(f);
|
||||
|
||||
if(f->version>2) avctx->pix_fmt= PIX_FMT_RGB565;
|
||||
else avctx->pix_fmt= PIX_FMT_RGB555;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static av_cold int decode_end(AVCodecContext *avctx){
|
||||
FourXContext * const f = avctx->priv_data;
|
||||
int i;
|
||||
|
||||
av_freep(&f->bitstream_buffer);
|
||||
f->bitstream_buffer_size=0;
|
||||
for(i=0; i<CFRAME_BUFFER_COUNT; i++){
|
||||
av_freep(&f->cfrm[i].data);
|
||||
f->cfrm[i].allocated_size= 0;
|
||||
}
|
||||
free_vlc(&f->pre_vlc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVCodec fourxm_decoder = {
|
||||
"4xm",
|
||||
CODEC_TYPE_VIDEO,
|
||||
CODEC_ID_4XM,
|
||||
sizeof(FourXContext),
|
||||
decode_init,
|
||||
NULL,
|
||||
decode_end,
|
||||
decode_frame,
|
||||
/*CODEC_CAP_DR1,*/
|
||||
.long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
|
||||
};
|
||||
|
||||
@@ -1,235 +0,0 @@
|
||||
/*
|
||||
* Quicktime Planar RGB (8BPS) Video Decoder
|
||||
* Copyright (C) 2003 Roberto Togni
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/8bps.c
|
||||
* QT 8BPS Video Decoder by Roberto Togni
|
||||
* For more information about the 8BPS format, visit:
|
||||
* http://www.pcisys.net/~melanson/codecs/
|
||||
*
|
||||
* Supports: PAL8 (RGB 8bpp, paletted)
|
||||
* : BGR24 (RGB 24bpp) (can also output it as RGB32)
|
||||
* : RGB32 (RGB 32bpp, 4th plane is probably alpha and it's ignored)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "avcodec.h"
|
||||
|
||||
|
||||
static const enum PixelFormat pixfmt_rgb24[] = {PIX_FMT_BGR24, PIX_FMT_RGB32, PIX_FMT_NONE};
|
||||
|
||||
/*
|
||||
* Decoder context
|
||||
*/
|
||||
typedef struct EightBpsContext {
|
||||
|
||||
AVCodecContext *avctx;
|
||||
AVFrame pic;
|
||||
|
||||
unsigned char planes;
|
||||
unsigned char planemap[4];
|
||||
} EightBpsContext;
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Decode a frame
|
||||
*
|
||||
*/
|
||||
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
|
||||
{
|
||||
EightBpsContext * const c = avctx->priv_data;
|
||||
const unsigned char *encoded = buf;
|
||||
unsigned char *pixptr, *pixptr_end;
|
||||
unsigned int height = avctx->height; // Real image height
|
||||
unsigned int dlen, p, row;
|
||||
const unsigned char *lp, *dp;
|
||||
unsigned char count;
|
||||
unsigned int px_inc;
|
||||
unsigned int planes = c->planes;
|
||||
unsigned char *planemap = c->planemap;
|
||||
|
||||
if(c->pic.data[0])
|
||||
avctx->release_buffer(avctx, &c->pic);
|
||||
|
||||
c->pic.reference = 0;
|
||||
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
|
||||
if(avctx->get_buffer(avctx, &c->pic) < 0){
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Set data pointer after line lengths */
|
||||
dp = encoded + planes * (height << 1);
|
||||
|
||||
/* Ignore alpha plane, don't know what to do with it */
|
||||
if (planes == 4)
|
||||
planes--;
|
||||
|
||||
px_inc = planes + (avctx->pix_fmt == PIX_FMT_RGB32);
|
||||
|
||||
for (p = 0; p < planes; p++) {
|
||||
/* Lines length pointer for this plane */
|
||||
lp = encoded + p * (height << 1);
|
||||
|
||||
/* Decode a plane */
|
||||
for(row = 0; row < height; row++) {
|
||||
pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p];
|
||||
pixptr_end = pixptr + c->pic.linesize[0];
|
||||
dlen = be2me_16(*(const unsigned short *)(lp+row*2));
|
||||
/* Decode a row of this plane */
|
||||
while(dlen > 0) {
|
||||
if(dp + 1 >= buf+buf_size) return -1;
|
||||
if ((count = *dp++) <= 127) {
|
||||
count++;
|
||||
dlen -= count + 1;
|
||||
if (pixptr + count * px_inc > pixptr_end)
|
||||
break;
|
||||
if(dp + count > buf+buf_size) return -1;
|
||||
while(count--) {
|
||||
*pixptr = *dp++;
|
||||
pixptr += px_inc;
|
||||
}
|
||||
} else {
|
||||
count = 257 - count;
|
||||
if (pixptr + count * px_inc > pixptr_end)
|
||||
break;
|
||||
while(count--) {
|
||||
*pixptr = *dp;
|
||||
pixptr += px_inc;
|
||||
}
|
||||
dp++;
|
||||
dlen -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (avctx->palctrl) {
|
||||
memcpy (c->pic.data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||
if (avctx->palctrl->palette_changed) {
|
||||
c->pic.palette_has_changed = 1;
|
||||
avctx->palctrl->palette_changed = 0;
|
||||
} else
|
||||
c->pic.palette_has_changed = 0;
|
||||
}
|
||||
|
||||
*data_size = sizeof(AVFrame);
|
||||
*(AVFrame*)data = c->pic;
|
||||
|
||||
/* always report that the buffer was completely consumed */
|
||||
return buf_size;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Init 8BPS decoder
|
||||
*
|
||||
*/
|
||||
static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
EightBpsContext * const c = avctx->priv_data;
|
||||
|
||||
c->avctx = avctx;
|
||||
|
||||
c->pic.data[0] = NULL;
|
||||
|
||||
if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (avctx->bits_per_coded_sample) {
|
||||
case 8:
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
c->planes = 1;
|
||||
c->planemap[0] = 0; // 1st plane is palette indexes
|
||||
if (avctx->palctrl == NULL) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error: PAL8 format but no palette from demuxer.\n");
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24);
|
||||
c->planes = 3;
|
||||
c->planemap[0] = 2; // 1st plane is red
|
||||
c->planemap[1] = 1; // 2nd plane is green
|
||||
c->planemap[2] = 0; // 3rd plane is blue
|
||||
break;
|
||||
case 32:
|
||||
avctx->pix_fmt = PIX_FMT_RGB32;
|
||||
c->planes = 4;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
c->planemap[0] = 1; // 1st plane is red
|
||||
c->planemap[1] = 2; // 2nd plane is green
|
||||
c->planemap[2] = 3; // 3rd plane is blue
|
||||
c->planemap[3] = 0; // 4th plane is alpha???
|
||||
#else
|
||||
c->planemap[0] = 2; // 1st plane is red
|
||||
c->planemap[1] = 1; // 2nd plane is green
|
||||
c->planemap[2] = 0; // 3rd plane is blue
|
||||
c->planemap[3] = 3; // 4th plane is alpha???
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", avctx->bits_per_coded_sample);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Uninit 8BPS decoder
|
||||
*
|
||||
*/
|
||||
static av_cold int decode_end(AVCodecContext *avctx)
|
||||
{
|
||||
EightBpsContext * const c = avctx->priv_data;
|
||||
|
||||
if (c->pic.data[0])
|
||||
avctx->release_buffer(avctx, &c->pic);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
AVCodec eightbps_decoder = {
|
||||
"8bps",
|
||||
CODEC_TYPE_VIDEO,
|
||||
CODEC_ID_8BPS,
|
||||
sizeof(EightBpsContext),
|
||||
decode_init,
|
||||
NULL,
|
||||
decode_end,
|
||||
decode_frame,
|
||||
CODEC_CAP_DR1,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("QuickTime 8BPS video"),
|
||||
};
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* 8SVX audio decoder
|
||||
* Copyright (C) 2008 Jaikrishnan Menon
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/8svx.c
|
||||
* 8svx audio decoder
|
||||
* @author Jaikrishnan Menon
|
||||
* supports: fibonacci delta encoding
|
||||
* : exponential encoding
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
|
||||
/** decoder context */
|
||||
typedef struct EightSvxContext {
|
||||
int16_t fib_acc;
|
||||
const int16_t *table;
|
||||
} EightSvxContext;
|
||||
|
||||
static const int16_t fibonacci[16] = { -34<<8, -21<<8, -13<<8, -8<<8, -5<<8, -3<<8, -2<<8, -1<<8,
|
||||
0, 1<<8, 2<<8, 3<<8, 5<<8, 8<<8, 13<<8, 21<<8 };
|
||||
static const int16_t exponential[16] = { -128<<8, -64<<8, -32<<8, -16<<8, -8<<8, -4<<8, -2<<8, -1<<8,
|
||||
0, 1<<8, 2<<8, 4<<8, 8<<8, 16<<8, 32<<8, 64<<8 };
|
||||
|
||||
/** decode a frame */
|
||||
static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
EightSvxContext *esc = avctx->priv_data;
|
||||
int16_t *out_data = data;
|
||||
int consumed = buf_size;
|
||||
const uint8_t *buf_end = buf + buf_size;
|
||||
|
||||
if((*data_size >> 2) < buf_size)
|
||||
return -1;
|
||||
|
||||
if(avctx->frame_number == 0) {
|
||||
esc->fib_acc = buf[1] << 8;
|
||||
buf_size -= 2;
|
||||
buf += 2;
|
||||
}
|
||||
|
||||
*data_size = buf_size << 2;
|
||||
|
||||
while(buf < buf_end) {
|
||||
uint8_t d = *buf++;
|
||||
esc->fib_acc += esc->table[d & 0x0f];
|
||||
*out_data++ = esc->fib_acc;
|
||||
esc->fib_acc += esc->table[d >> 4];
|
||||
*out_data++ = esc->fib_acc;
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
/** initialize 8svx decoder */
|
||||
static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
EightSvxContext *esc = avctx->priv_data;
|
||||
|
||||
switch(avctx->codec->id) {
|
||||
case CODEC_ID_8SVX_FIB:
|
||||
esc->table = fibonacci;
|
||||
break;
|
||||
case CODEC_ID_8SVX_EXP:
|
||||
esc->table = exponential;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVCodec eightsvx_fib_decoder = {
|
||||
.name = "8svx_fib",
|
||||
.type = CODEC_TYPE_AUDIO,
|
||||
.id = CODEC_ID_8SVX_FIB,
|
||||
.priv_data_size = sizeof (EightSvxContext),
|
||||
.init = eightsvx_decode_init,
|
||||
.decode = eightsvx_decode_frame,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("8SVX fibonacci"),
|
||||
};
|
||||
|
||||
AVCodec eightsvx_exp_decoder = {
|
||||
.name = "8svx_exp",
|
||||
.type = CODEC_TYPE_AUDIO,
|
||||
.id = CODEC_ID_8SVX_EXP,
|
||||
.priv_data_size = sizeof (EightSvxContext),
|
||||
.init = eightsvx_decode_init,
|
||||
.decode = eightsvx_decode_frame,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("8SVX exponential"),
|
||||
};
|
||||
@@ -1,538 +0,0 @@
|
||||
include $(SUBDIR)../config.mak
|
||||
|
||||
NAME = avcodec
|
||||
FFLIBS = avutil
|
||||
|
||||
HEADERS = avcodec.h opt.h vdpau.h xvmc.h
|
||||
|
||||
OBJS = allcodecs.o \
|
||||
audioconvert.o \
|
||||
bitstream.o \
|
||||
bitstream_filter.o \
|
||||
dsputil.o \
|
||||
eval.o \
|
||||
faanidct.o \
|
||||
imgconvert.o \
|
||||
jrevdct.o \
|
||||
opt.o \
|
||||
options.o \
|
||||
parser.o \
|
||||
raw.o \
|
||||
resample.o \
|
||||
resample2.o \
|
||||
simple_idct.o \
|
||||
utils.o \
|
||||
|
||||
# parts needed for many different codecs
|
||||
OBJS-$(CONFIG_AANDCT) += aandcttab.o
|
||||
OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o
|
||||
OBJS-$(CONFIG_FFT) += fft.o
|
||||
OBJS-$(CONFIG_GOLOMB) += golomb.o
|
||||
OBJS-$(CONFIG_MDCT) += mdct.o
|
||||
OBJS-$(CONFIG_OLDSCALER) += imgresample.o
|
||||
OBJS-$(CONFIG_RDFT) += rdft.o
|
||||
|
||||
# decoders/encoders
|
||||
OBJS-$(CONFIG_AAC_DECODER) += aac.o aactab.o mpeg4audio.o aac_parser.o aac_ac3_parser.o
|
||||
OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o
|
||||
OBJS-$(CONFIG_AC3_DECODER) += eac3dec.o ac3dec.o ac3tab.o ac3dec_data.o ac3.o
|
||||
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc.o ac3tab.o ac3.o
|
||||
OBJS-$(CONFIG_ALAC_DECODER) += alac.o
|
||||
OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o lpc.o
|
||||
OBJS-$(CONFIG_AMV_DECODER) += sp5xdec.o mjpegdec.o mjpeg.o
|
||||
OBJS-$(CONFIG_APE_DECODER) += apedec.o
|
||||
OBJS-$(CONFIG_ASV1_DECODER) += asv1.o mpeg12data.o
|
||||
OBJS-$(CONFIG_ASV1_ENCODER) += asv1.o mpeg12data.o
|
||||
OBJS-$(CONFIG_ASV2_DECODER) += asv1.o mpeg12data.o
|
||||
OBJS-$(CONFIG_ASV2_ENCODER) += asv1.o mpeg12data.o
|
||||
OBJS-$(CONFIG_ATRAC3_DECODER) += atrac3.o
|
||||
OBJS-$(CONFIG_AVS_DECODER) += avs.o
|
||||
OBJS-$(CONFIG_BETHSOFTVID_DECODER) += bethsoftvideo.o
|
||||
OBJS-$(CONFIG_BFI_DECODER) += bfi.o
|
||||
OBJS-$(CONFIG_BMP_DECODER) += bmp.o msrledec.o
|
||||
OBJS-$(CONFIG_BMP_ENCODER) += bmpenc.o
|
||||
OBJS-$(CONFIG_C93_DECODER) += c93.o
|
||||
OBJS-$(CONFIG_CAVS_DECODER) += cavs.o cavsdec.o cavsdsp.o mpeg12data.o mpegvideo.o
|
||||
OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
|
||||
OBJS-$(CONFIG_CLJR_DECODER) += cljr.o
|
||||
OBJS-$(CONFIG_CLJR_ENCODER) += cljr.o
|
||||
OBJS-$(CONFIG_COOK_DECODER) += cook.o
|
||||
OBJS-$(CONFIG_CSCD_DECODER) += cscd.o
|
||||
OBJS-$(CONFIG_CYUV_DECODER) += cyuv.o
|
||||
OBJS-$(CONFIG_DCA_DECODER) += dca.o
|
||||
OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o
|
||||
OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o mpegvideo_enc.o motion_est.o ratecontrol.o mpeg12data.o mpegvideo.o
|
||||
OBJS-$(CONFIG_DSICINAUDIO_DECODER) += dsicinav.o
|
||||
OBJS-$(CONFIG_DSICINVIDEO_DECODER) += dsicinav.o
|
||||
OBJS-$(CONFIG_DVBSUB_DECODER) += dvbsubdec.o
|
||||
OBJS-$(CONFIG_DVBSUB_ENCODER) += dvbsub.o
|
||||
OBJS-$(CONFIG_DVDSUB_DECODER) += dvdsubdec.o
|
||||
OBJS-$(CONFIG_DVDSUB_ENCODER) += dvdsubenc.o
|
||||
OBJS-$(CONFIG_DVVIDEO_DECODER) += dv.o
|
||||
OBJS-$(CONFIG_DVVIDEO_ENCODER) += dv.o
|
||||
OBJS-$(CONFIG_DXA_DECODER) += dxa.o
|
||||
OBJS-$(CONFIG_EAC3_DECODER) += eac3dec.o ac3dec.o ac3tab.o ac3dec_data.o ac3.o
|
||||
OBJS-$(CONFIG_EACMV_DECODER) += eacmv.o
|
||||
OBJS-$(CONFIG_EATGQ_DECODER) += eatgq.o eaidct.o
|
||||
OBJS-$(CONFIG_EATGV_DECODER) += eatgv.o
|
||||
OBJS-$(CONFIG_EATQI_DECODER) += eatqi.o eaidct.o mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_EIGHTBPS_DECODER) += 8bps.o
|
||||
OBJS-$(CONFIG_EIGHTSVX_EXP_DECODER) += 8svx.o
|
||||
OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER) += 8svx.o
|
||||
OBJS-$(CONFIG_ESCAPE124_DECODER) += escape124.o
|
||||
OBJS-$(CONFIG_FFV1_DECODER) += ffv1.o rangecoder.o
|
||||
OBJS-$(CONFIG_FFV1_ENCODER) += ffv1.o rangecoder.o
|
||||
OBJS-$(CONFIG_FFVHUFF_DECODER) += huffyuv.o
|
||||
OBJS-$(CONFIG_FFVHUFF_ENCODER) += huffyuv.o
|
||||
OBJS-$(CONFIG_FLAC_DECODER) += flacdec.o
|
||||
OBJS-$(CONFIG_FLAC_ENCODER) += flacenc.o lpc.o
|
||||
OBJS-$(CONFIG_FLASHSV_DECODER) += flashsv.o
|
||||
OBJS-$(CONFIG_FLASHSV_ENCODER) += flashsvenc.o
|
||||
OBJS-$(CONFIG_FLIC_DECODER) += flicvideo.o
|
||||
OBJS-$(CONFIG_FLV_DECODER) += h263dec.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_FLV_ENCODER) += mpegvideo_enc.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_FOURXM_DECODER) += 4xm.o
|
||||
OBJS-$(CONFIG_FRAPS_DECODER) += fraps.o huffman.o
|
||||
OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o
|
||||
OBJS-$(CONFIG_GIF_ENCODER) += gif.o
|
||||
OBJS-$(CONFIG_H261_DECODER) += h261dec.o h261.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o mpegvideo_enc.o motion_est.o ratecontrol.o mpeg12data.o mpegvideo.o
|
||||
OBJS-$(CONFIG_H263_DECODER) += h263dec.o h263.o h263_parser.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_H263I_DECODER) += h263dec.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_H263_ENCODER) += mpegvideo_enc.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_H263P_ENCODER) += mpegvideo_enc.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_H264_DECODER) += h264.o h264idct.o h264pred.o h264_parser.o cabac.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_H264_ENCODER) += h264enc.o h264dspenc.o
|
||||
OBJS-$(CONFIG_H264_VDPAU_DECODER) += vdpau.o h264.o h264idct.o h264pred.o h264_parser.o cabac.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o
|
||||
OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o
|
||||
OBJS-$(CONFIG_IDCIN_DECODER) += idcinvideo.o
|
||||
OBJS-$(CONFIG_IMC_DECODER) += imc.o
|
||||
OBJS-$(CONFIG_INDEO2_DECODER) += indeo2.o
|
||||
OBJS-$(CONFIG_INDEO3_DECODER) += indeo3.o
|
||||
OBJS-$(CONFIG_INTERPLAY_DPCM_DECODER) += dpcm.o
|
||||
OBJS-$(CONFIG_INTERPLAY_VIDEO_DECODER) += interplayvideo.o
|
||||
OBJS-$(CONFIG_JPEGLS_DECODER) += jpeglsdec.o jpegls.o mjpegdec.o mjpeg.o
|
||||
OBJS-$(CONFIG_JPEGLS_ENCODER) += jpeglsenc.o jpegls.o
|
||||
OBJS-$(CONFIG_KMVC_DECODER) += kmvc.o
|
||||
OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpegenc.o mjpeg.o mpegvideo_enc.o motion_est.o ratecontrol.o mpeg12data.o mpegvideo.o
|
||||
OBJS-$(CONFIG_LOCO_DECODER) += loco.o
|
||||
OBJS-$(CONFIG_MACE3_DECODER) += mace.o
|
||||
OBJS-$(CONFIG_MACE6_DECODER) += mace.o
|
||||
OBJS-$(CONFIG_MDEC_DECODER) += mdec.o mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MIMIC_DECODER) += mimic.o
|
||||
OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o mjpeg.o
|
||||
OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o mpegvideo_enc.o motion_est.o ratecontrol.o mpeg12data.o mpegvideo.o
|
||||
OBJS-$(CONFIG_MJPEGB_DECODER) += mjpegbdec.o mjpegdec.o mjpeg.o
|
||||
OBJS-$(CONFIG_MLP_DECODER) += mlpdec.o mlp_parser.o mlp.o
|
||||
OBJS-$(CONFIG_MMVIDEO_DECODER) += mmvideo.o
|
||||
OBJS-$(CONFIG_MOTIONPIXELS_DECODER) += motionpixels.o
|
||||
OBJS-$(CONFIG_MP1_DECODER) += mpegaudiodec.o mpegaudiodecheader.o mpegaudio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MP2_DECODER) += mpegaudiodec.o mpegaudiodecheader.o mpegaudio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MP2_ENCODER) += mpegaudioenc.o mpegaudio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MP3ADU_DECODER) += mpegaudiodec.o mpegaudiodecheader.o mpegaudio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MP3ON4_DECODER) += mpegaudiodec.o mpegaudiodecheader.o mpegaudio.o mpegaudiodata.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec.o mpegaudiodecheader.o mpegaudio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MPC7_DECODER) += mpc7.o mpc.o mpegaudiodec.o mpegaudiodecheader.o mpegaudio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o mpegaudiodec.o mpegaudiodecheader.o mpegaudio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MPEG_VDPAU_DECODER) += vdpau.o mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEG1_VDPAU_DECODER) += vdpau.o mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEG_XVMC_DECODER) += mpegvideo_xvmc.o mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEGVIDEO_DECODER) += mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpeg12data.o mpegvideo_enc.o motion_est.o ratecontrol.o mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12data.o mpegvideo_enc.o motion_est.o ratecontrol.o mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEG4_DECODER) += h263dec.o h263.o mpeg4video_parser.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEG4_ENCODER) += mpegvideo_enc.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MSMPEG4V1_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MSMPEG4V1_ENCODER) += msmpeg4.o msmpeg4data.o mpegvideo_enc.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MSMPEG4V2_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MSMPEG4V2_ENCODER) += msmpeg4.o msmpeg4data.o mpegvideo_enc.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MSMPEG4V3_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4.o msmpeg4data.o mpegvideo_enc.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o
|
||||
OBJS-$(CONFIG_MSVIDEO1_DECODER) += msvideo1.o
|
||||
OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o
|
||||
OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o
|
||||
OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o
|
||||
OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o
|
||||
OBJS-$(CONFIG_PAM_ENCODER) += pnmenc.o pnm.o
|
||||
OBJS-$(CONFIG_PBM_ENCODER) += pnmenc.o pnm.o
|
||||
OBJS-$(CONFIG_PCX_DECODER) += pcx.o
|
||||
OBJS-$(CONFIG_PGM_ENCODER) += pnmenc.o pnm.o
|
||||
OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o pnm.o
|
||||
OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o
|
||||
OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o
|
||||
OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o pnm.o
|
||||
OBJS-$(CONFIG_PTX_DECODER) += ptx.o
|
||||
OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o qcelp_lsp.o celp_math.o celp_filters.o
|
||||
OBJS-$(CONFIG_QDM2_DECODER) += qdm2.o mpegaudiodec.o mpegaudiodecheader.o mpegaudio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_QDRAW_DECODER) += qdrw.o
|
||||
OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o
|
||||
OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o
|
||||
OBJS-$(CONFIG_QTRLE_ENCODER) += qtrleenc.o
|
||||
OBJS-$(CONFIG_RA_144_DECODER) += ra144.o celp_filters.o
|
||||
OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_math.o celp_filters.o
|
||||
OBJS-$(CONFIG_RAWVIDEO_DECODER) += rawdec.o
|
||||
OBJS-$(CONFIG_RAWVIDEO_ENCODER) += rawenc.o
|
||||
OBJS-$(CONFIG_RL2_DECODER) += rl2.o
|
||||
OBJS-$(CONFIG_ROQ_DECODER) += roqvideodec.o roqvideo.o
|
||||
OBJS-$(CONFIG_ROQ_ENCODER) += roqvideoenc.o roqvideo.o elbg.o
|
||||
OBJS-$(CONFIG_ROQ_DPCM_DECODER) += dpcm.o
|
||||
OBJS-$(CONFIG_ROQ_DPCM_ENCODER) += roqaudioenc.o
|
||||
OBJS-$(CONFIG_RPZA_DECODER) += rpza.o
|
||||
OBJS-$(CONFIG_RV10_DECODER) += rv10.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_RV10_ENCODER) += rv10.o mpegvideo_enc.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_RV20_DECODER) += rv10.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_RV20_ENCODER) += rv10.o mpegvideo_enc.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_RV30_DECODER) += rv30.o rv34.o h264pred.o rv30dsp.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_RV40_DECODER) += rv40.o rv34.o h264pred.o rv40dsp.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_SGI_DECODER) += sgidec.o
|
||||
OBJS-$(CONFIG_SGI_ENCODER) += sgienc.o rle.o
|
||||
OBJS-$(CONFIG_SHORTEN_DECODER) += shorten.o
|
||||
OBJS-$(CONFIG_SMACKAUD_DECODER) += smacker.o
|
||||
OBJS-$(CONFIG_SMACKER_DECODER) += smacker.o
|
||||
OBJS-$(CONFIG_SMC_DECODER) += smc.o
|
||||
OBJS-$(CONFIG_SNOW_DECODER) += snow.o rangecoder.o
|
||||
OBJS-$(CONFIG_SNOW_ENCODER) += snow.o rangecoder.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_SOL_DPCM_DECODER) += dpcm.o
|
||||
OBJS-$(CONFIG_SONIC_DECODER) += sonic.o
|
||||
OBJS-$(CONFIG_SONIC_ENCODER) += sonic.o
|
||||
OBJS-$(CONFIG_SONIC_LS_ENCODER) += sonic.o
|
||||
OBJS-$(CONFIG_SP5X_DECODER) += sp5xdec.o mjpegdec.o mjpeg.o
|
||||
OBJS-$(CONFIG_SUNRAST_DECODER) += sunrast.o
|
||||
OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o motion_est.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_SVQ3_DECODER) += h264.o h264idct.o h264pred.o h264_parser.o cabac.o mpegvideo.o error_resilience.o svq1dec.o svq1.o h263.o
|
||||
OBJS-$(CONFIG_TARGA_DECODER) += targa.o
|
||||
OBJS-$(CONFIG_TARGA_ENCODER) += targaenc.o rle.o
|
||||
OBJS-$(CONFIG_THEORA_DECODER) += vp3.o xiph.o vp3dsp.o
|
||||
OBJS-$(CONFIG_THP_DECODER) += mjpegdec.o mjpeg.o
|
||||
OBJS-$(CONFIG_TIERTEXSEQVIDEO_DECODER) += tiertexseqv.o
|
||||
OBJS-$(CONFIG_TIFF_DECODER) += tiff.o lzw.o faxcompr.o
|
||||
OBJS-$(CONFIG_TIFF_ENCODER) += tiffenc.o rle.o lzwenc.o
|
||||
OBJS-$(CONFIG_TRUEMOTION1_DECODER) += truemotion1.o
|
||||
OBJS-$(CONFIG_TRUEMOTION2_DECODER) += truemotion2.o
|
||||
OBJS-$(CONFIG_TRUESPEECH_DECODER) += truespeech.o
|
||||
OBJS-$(CONFIG_TSCC_DECODER) += tscc.o msrledec.o
|
||||
OBJS-$(CONFIG_TTA_DECODER) += tta.o
|
||||
OBJS-$(CONFIG_TXD_DECODER) += txd.o s3tc.o
|
||||
OBJS-$(CONFIG_ULTI_DECODER) += ulti.o
|
||||
OBJS-$(CONFIG_VB_DECODER) += vb.o
|
||||
OBJS-$(CONFIG_VC1_DECODER) += vc1.o vc1data.o vc1dsp.o msmpeg4data.o h263dec.o h263.o intrax8.o intrax8dsp.o error_resilience.o mpegvideo.o msmpeg4.o
|
||||
OBJS-$(CONFIG_VC1_VDPAU_DECODER) += vdpau.o vc1.o vc1data.o vc1dsp.o msmpeg4data.o h263dec.o h263.o intrax8.o intrax8dsp.o error_resilience.o mpegvideo.o msmpeg4.o
|
||||
OBJS-$(CONFIG_VCR1_DECODER) += vcr1.o
|
||||
OBJS-$(CONFIG_VCR1_ENCODER) += vcr1.o
|
||||
OBJS-$(CONFIG_VMDAUDIO_DECODER) += vmdav.o
|
||||
OBJS-$(CONFIG_VMDVIDEO_DECODER) += vmdav.o
|
||||
OBJS-$(CONFIG_VMNC_DECODER) += vmnc.o
|
||||
OBJS-$(CONFIG_VORBIS_DECODER) += vorbis_dec.o vorbis.o vorbis_data.o xiph.o
|
||||
OBJS-$(CONFIG_VORBIS_ENCODER) += vorbis_enc.o vorbis.o vorbis_data.o
|
||||
OBJS-$(CONFIG_VP3_DECODER) += vp3.o vp3dsp.o
|
||||
OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o vp3dsp.o
|
||||
OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o vp3dsp.o vp6dsp.o huffman.o
|
||||
OBJS-$(CONFIG_VP6A_DECODER) += vp6.o vp56.o vp56data.o vp3dsp.o vp6dsp.o huffman.o
|
||||
OBJS-$(CONFIG_VP6F_DECODER) += vp6.o vp56.o vp56data.o vp3dsp.o vp6dsp.o huffman.o
|
||||
OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
|
||||
OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
|
||||
OBJS-$(CONFIG_WMAV1_DECODER) += wmadec.o wma.o
|
||||
OBJS-$(CONFIG_WMAV1_ENCODER) += wmaenc.o wma.o
|
||||
OBJS-$(CONFIG_WMAV2_DECODER) += wmadec.o wma.o
|
||||
OBJS-$(CONFIG_WMAV2_ENCODER) += wmaenc.o wma.o
|
||||
OBJS-$(CONFIG_WMV1_DECODER) += h263dec.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_WMV1_ENCODER) += mpegvideo_enc.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_WMV2_DECODER) += wmv2dec.o wmv2.o msmpeg4.o msmpeg4data.o h263dec.o h263.o intrax8.o intrax8dsp.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2.o msmpeg4.o msmpeg4data.o mpegvideo_enc.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_WMV3_DECODER) += vc1.o vc1data.o vc1dsp.o msmpeg4data.o h263dec.o h263.o intrax8.o intrax8dsp.o error_resilience.o mpegvideo.o msmpeg4.o
|
||||
OBJS-$(CONFIG_WMV3_VDPAU_DECODER) += vdpau.o vc1.o vc1data.o vc1dsp.o msmpeg4data.o h263dec.o h263.o intrax8.o intrax8dsp.o error_resilience.o mpegvideo.o msmpeg4.o
|
||||
OBJS-$(CONFIG_WNV1_DECODER) += wnv1.o
|
||||
OBJS-$(CONFIG_WS_SND1_DECODER) += ws-snd1.o
|
||||
OBJS-$(CONFIG_XAN_DPCM_DECODER) += dpcm.o
|
||||
OBJS-$(CONFIG_XAN_WC3_DECODER) += xan.o
|
||||
OBJS-$(CONFIG_XAN_WC4_DECODER) += xan.o
|
||||
OBJS-$(CONFIG_XL_DECODER) += xl.o
|
||||
OBJS-$(CONFIG_XSUB_DECODER) += xsubdec.o
|
||||
OBJS-$(CONFIG_ZLIB_DECODER) += lcldec.o
|
||||
OBJS-$(CONFIG_ZLIB_ENCODER) += lclenc.o
|
||||
OBJS-$(CONFIG_ZMBV_DECODER) += zmbv.o
|
||||
OBJS-$(CONFIG_ZMBV_ENCODER) += zmbvenc.o
|
||||
|
||||
# (AD)PCM decoders/encoders
|
||||
OBJS-$(CONFIG_PCM_ALAW_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_ALAW_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_DVD_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_DVD_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_F32BE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_F32BE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_F32LE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_F32LE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_F64BE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_F64BE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_F64LE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_F64LE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_MULAW_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_MULAW_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S8_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S8_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S16BE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S16BE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S16LE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S16LE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S16LE_PLANAR_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S24BE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S24BE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S24DAUD_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S24DAUD_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S24LE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S24LE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S32BE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S32BE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S32LE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S32LE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U8_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U8_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U16BE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U16BE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U16LE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U16LE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U24BE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U24BE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U24LE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U24LE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U32BE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U32BE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U32LE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U32LE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_ZORK_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_ZORK_ENCODER) += pcm.o
|
||||
|
||||
OBJS-$(CONFIG_ADPCM_4XM_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_ADX_DECODER) += adxdec.o
|
||||
OBJS-$(CONFIG_ADPCM_ADX_ENCODER) += adxenc.o
|
||||
OBJS-$(CONFIG_ADPCM_CT_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_EA_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_EA_MAXIS_XA_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_EA_R1_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_EA_R2_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_EA_R3_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_EA_XAS_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_G726_DECODER) += g726.o
|
||||
OBJS-$(CONFIG_ADPCM_G726_ENCODER) += g726.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_AMV_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_DK3_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_DK4_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_EA_EACS_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_EA_SEAD_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_ISS_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_QT_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_QT_ENCODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_SMJPEG_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_WAV_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_WAV_ENCODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_WS_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_MS_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_MS_ENCODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_SBPRO_2_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_SBPRO_3_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_SBPRO_4_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_SWF_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_SWF_ENCODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_THP_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_XA_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_YAMAHA_DECODER) += adpcm.o
|
||||
OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcm.o
|
||||
|
||||
# libavformat dependencies
|
||||
OBJS-$(CONFIG_EAC3_DEMUXER) += ac3_parser.o ac3tab.o aac_ac3_parser.o
|
||||
OBJS-$(CONFIG_FLAC_MUXER) += flacdec.o
|
||||
OBJS-$(CONFIG_GXF_DEMUXER) += mpeg12data.o
|
||||
OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += xiph.o mpeg4audio.o flacdec.o
|
||||
OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o mpeg4audio.o flacdec.o
|
||||
OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MPEGTS_MUXER) += mpegvideo.o
|
||||
OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o
|
||||
OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o
|
||||
OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o
|
||||
OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o
|
||||
|
||||
# external codec libraries
|
||||
OBJS-$(CONFIG_LIBAMR_NB) += libamr.o
|
||||
OBJS-$(CONFIG_LIBAMR_WB) += libamr.o
|
||||
OBJS-$(CONFIG_LIBDIRAC_DECODER) += libdiracdec.o
|
||||
OBJS-$(CONFIG_LIBDIRAC_ENCODER) += libdiracenc.o libdirac_libschro.o
|
||||
OBJS-$(CONFIG_LIBFAAC) += libfaac.o
|
||||
OBJS-$(CONFIG_LIBFAAD) += libfaad.o
|
||||
OBJS-$(CONFIG_LIBGSM) += libgsm.o
|
||||
OBJS-$(CONFIG_LIBMP3LAME) += libmp3lame.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRNB) += libopencore-amr.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRWB) += libopencore-amr.o
|
||||
OBJS-$(CONFIG_LIBOPENJPEG) += libopenjpeg.o
|
||||
OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o libschroedinger.o libdirac_libschro.o
|
||||
OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o libschroedinger.o libdirac_libschro.o
|
||||
OBJS-$(CONFIG_LIBSPEEX) += libspeexdec.o
|
||||
OBJS-$(CONFIG_LIBTHEORA) += libtheoraenc.o
|
||||
OBJS-$(CONFIG_LIBVORBIS) += libvorbis.o
|
||||
OBJS-$(CONFIG_LIBX264) += libx264.o
|
||||
OBJS-$(CONFIG_LIBXVID) += libxvidff.o libxvid_rc.o
|
||||
|
||||
# parsers
|
||||
OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_AC3_PARSER) += ac3_parser.o ac3tab.o aac_ac3_parser.o
|
||||
OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o
|
||||
OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o
|
||||
OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o
|
||||
OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o
|
||||
OBJS-$(CONFIG_DVBSUB_PARSER) += dvbsub_parser.o
|
||||
OBJS-$(CONFIG_DVDSUB_PARSER) += dvdsub_parser.o
|
||||
OBJS-$(CONFIG_H261_PARSER) += h261_parser.o
|
||||
OBJS-$(CONFIG_H263_PARSER) += h263_parser.o
|
||||
OBJS-$(CONFIG_H264_PARSER) += h264_parser.o
|
||||
OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg_parser.o
|
||||
OBJS-$(CONFIG_MLP_PARSER) += mlp_parser.o mlp.o
|
||||
OBJS-$(CONFIG_MPEG4VIDEO_PARSER) += mpeg4video_parser.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEGAUDIO_PARSER) += mpegaudio_parser.o mpegaudiodecheader.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MPEGVIDEO_PARSER) += mpegvideo_parser.o mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o
|
||||
OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o
|
||||
OBJS-$(CONFIG_VP3_PARSER) += vp3_parser.o
|
||||
|
||||
# bitstream filters
|
||||
OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
|
||||
OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o
|
||||
OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF) += imx_dump_header_bsf.o
|
||||
OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o
|
||||
OBJS-$(CONFIG_MOV2TEXTSUB_BSF) += movsub_bsf.o
|
||||
OBJS-$(CONFIG_MP3_HEADER_COMPRESS_BSF) += mp3_header_compress_bsf.o
|
||||
OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) += mp3_header_decompress_bsf.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o
|
||||
OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o
|
||||
OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o
|
||||
|
||||
# thread libraries
|
||||
OBJS-$(HAVE_BEOSTHREADS) += beosthread.o
|
||||
OBJS-$(HAVE_OS2THREADS) += os2thread.o
|
||||
OBJS-$(HAVE_PTHREADS) += pthread.o
|
||||
OBJS-$(HAVE_W32THREADS) += w32thread.o
|
||||
|
||||
# processor-specific code
|
||||
YASM-OBJS-FFT-$(HAVE_AMD3DNOW) += x86/fft_3dn.o
|
||||
YASM-OBJS-FFT-$(HAVE_AMD3DNOWEXT) += x86/fft_3dn2.o
|
||||
YASM-OBJS-FFT-$(HAVE_SSE) += x86/fft_sse.o
|
||||
YASM-OBJS-$(CONFIG_FFT) += x86/fft_mmx.o $(YASM-OBJS-FFT-yes)
|
||||
YASM-OBJS-$(CONFIG_GPL) += x86/h264_deblock_sse2.o \
|
||||
x86/h264_idct_sse2.o \
|
||||
|
||||
MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp_mmx.o
|
||||
MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o
|
||||
MMX-OBJS-$(CONFIG_FLAC_ENCODER) += x86/flacdsp_mmx.o
|
||||
MMX-OBJS-$(CONFIG_GPL) += x86/idct_mmx.o
|
||||
MMX-OBJS-$(CONFIG_SNOW_DECODER) += x86/snowdsp_mmx.o
|
||||
MMX-OBJS-$(CONFIG_THEORA_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o
|
||||
MMX-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_mmx.o
|
||||
MMX-OBJS-$(CONFIG_VP3_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o
|
||||
MMX-OBJS-$(CONFIG_VP5_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o
|
||||
MMX-OBJS-$(CONFIG_VP6_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o \
|
||||
x86/vp6dsp_mmx.o x86/vp6dsp_sse2.o
|
||||
MMX-OBJS-$(CONFIG_VP6A_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o \
|
||||
x86/vp6dsp_mmx.o x86/vp6dsp_sse2.o
|
||||
MMX-OBJS-$(CONFIG_VP6F_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o \
|
||||
x86/vp6dsp_mmx.o x86/vp6dsp_sse2.o
|
||||
MMX-OBJS-$(CONFIG_WMV3_DECODER) += x86/vc1dsp_mmx.o
|
||||
MMX-OBJS-$(HAVE_YASM) += x86/dsputil_yasm.o \
|
||||
$(YASM-OBJS-yes)
|
||||
|
||||
OBJS-$(HAVE_MMX) += x86/cpuid.o \
|
||||
x86/dnxhd_mmx.o \
|
||||
x86/dsputil_mmx.o \
|
||||
x86/fdct_mmx.o \
|
||||
x86/idct_mmx_xvid.o \
|
||||
x86/idct_sse2_xvid.o \
|
||||
x86/motion_est_mmx.o \
|
||||
x86/mpegvideo_mmx.o \
|
||||
x86/simple_idct_mmx.o \
|
||||
$(MMX-OBJS-yes)
|
||||
|
||||
OBJS-$(ARCH_ALPHA) += alpha/dsputil_alpha.o \
|
||||
alpha/dsputil_alpha_asm.o \
|
||||
alpha/motion_est_alpha.o \
|
||||
alpha/motion_est_mvi_asm.o \
|
||||
alpha/mpegvideo_alpha.o \
|
||||
alpha/simple_idct_alpha.o \
|
||||
|
||||
OBJS-$(ARCH_ARM) += arm/dsputil_arm.o \
|
||||
arm/dsputil_arm_s.o \
|
||||
arm/jrevdct_arm.o \
|
||||
arm/mpegvideo_arm.o \
|
||||
arm/simple_idct_arm.o \
|
||||
|
||||
OBJS-$(HAVE_ARMV5TE) += arm/mpegvideo_armv5te.o \
|
||||
arm/mpegvideo_armv5te_s.o \
|
||||
arm/simple_idct_armv5te.o \
|
||||
|
||||
OBJS-$(HAVE_ARMV6) += arm/simple_idct_armv6.o \
|
||||
|
||||
OBJS-$(HAVE_ARMVFP) += arm/dsputil_vfp.o \
|
||||
arm/float_arm_vfp.o \
|
||||
|
||||
OBJS-$(HAVE_IWMMXT) += arm/dsputil_iwmmxt.o \
|
||||
arm/mpegvideo_iwmmxt.o \
|
||||
|
||||
OBJS-$(HAVE_NEON) += arm/dsputil_neon.o \
|
||||
arm/dsputil_neon_s.o \
|
||||
arm/h264dsp_neon.o \
|
||||
arm/h264idct_neon.o \
|
||||
arm/simple_idct_neon.o \
|
||||
|
||||
OBJS-$(ARCH_BFIN) += bfin/dsputil_bfin.o \
|
||||
bfin/fdct_bfin.o \
|
||||
bfin/idct_bfin.o \
|
||||
bfin/mpegvideo_bfin.o \
|
||||
bfin/pixels_bfin.o \
|
||||
bfin/vp3_bfin.o \
|
||||
bfin/vp3_idct_bfin.o \
|
||||
|
||||
OBJS-$(ARCH_PPC) += ppc/dsputil_ppc.o \
|
||||
|
||||
ALTIVEC-OBJS-$(CONFIG_H264_DECODER) += ppc/h264_altivec.o
|
||||
ALTIVEC-OBJS-$(CONFIG_OLDSCALER) += ppc/imgresample_altivec.o
|
||||
ALTIVEC-OBJS-$(CONFIG_SNOW_DECODER) += ppc/snow_altivec.o
|
||||
ALTIVEC-OBJS-$(CONFIG_VC1_DECODER) += ppc/vc1dsp_altivec.o
|
||||
ALTIVEC-OBJS-$(CONFIG_WMV3_DECODER) += ppc/vc1dsp_altivec.o
|
||||
|
||||
OBJS-$(HAVE_ALTIVEC) += ppc/check_altivec.o \
|
||||
ppc/dsputil_altivec.o \
|
||||
ppc/fdct_altivec.o \
|
||||
ppc/fft_altivec.o \
|
||||
ppc/float_altivec.o \
|
||||
ppc/gmc_altivec.o \
|
||||
ppc/idct_altivec.o \
|
||||
ppc/int_altivec.o \
|
||||
ppc/mpegvideo_altivec.o \
|
||||
$(ALTIVEC-OBJS-yes)
|
||||
|
||||
OBJS-$(ARCH_SH4) += sh4/dsputil_align.o \
|
||||
sh4/dsputil_sh4.o \
|
||||
sh4/idct_sh4.o \
|
||||
|
||||
OBJS-$(CONFIG_MLIB) += mlib/dsputil_mlib.o \
|
||||
|
||||
OBJS-$(HAVE_MMI) += ps2/dsputil_mmi.o \
|
||||
ps2/idct_mmi.o \
|
||||
ps2/mpegvideo_mmi.o \
|
||||
|
||||
OBJS-$(HAVE_VIS) += sparc/dsputil_vis.o \
|
||||
sparc/simple_idct_vis.o \
|
||||
|
||||
|
||||
TESTS = $(addsuffix -test$(EXESUF), cabac dct eval fft h264 rangecoder snow)
|
||||
TESTS-$(CONFIG_OLDSCALER) += imgresample-test$(EXESUF)
|
||||
TESTS-$(ARCH_X86) += x86/cpuid-test$(EXESUF) motion-test$(EXESUF)
|
||||
|
||||
CLEANFILES = apiexample$(EXESUF)
|
||||
DIRS = alpha arm bfin mlib ppc ps2 sh4 sparc x86
|
||||
|
||||
include $(SUBDIR)../subdir.mak
|
||||
|
||||
$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o $(SUBDIR)aandcttab.o
|
||||
-1738
File diff suppressed because it is too large
Load Diff
@@ -1,297 +0,0 @@
|
||||
/*
|
||||
* AAC definitions and structures
|
||||
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
|
||||
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/aac.h
|
||||
* AAC definitions and structures
|
||||
* @author Oded Shimon ( ods15 ods15 dyndns org )
|
||||
* @author Maxim Gavrilov ( maxim.gavrilov gmail com )
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AAC_H
|
||||
#define AVCODEC_AAC_H
|
||||
|
||||
#include "libavutil/internal.h"
|
||||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
#include "mpeg4audio.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define AAC_INIT_VLC_STATIC(num, size) \
|
||||
INIT_VLC_STATIC(&vlc_spectral[num], 6, ff_aac_spectral_sizes[num], \
|
||||
ff_aac_spectral_bits[num], sizeof( ff_aac_spectral_bits[num][0]), sizeof( ff_aac_spectral_bits[num][0]), \
|
||||
ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), sizeof(ff_aac_spectral_codes[num][0]), \
|
||||
size);
|
||||
|
||||
#define MAX_CHANNELS 64
|
||||
#define MAX_ELEM_ID 16
|
||||
|
||||
#define TNS_MAX_ORDER 20
|
||||
|
||||
enum AudioObjectType {
|
||||
AOT_NULL,
|
||||
// Support? Name
|
||||
AOT_AAC_MAIN, ///< Y Main
|
||||
AOT_AAC_LC, ///< Y Low Complexity
|
||||
AOT_AAC_SSR, ///< N (code in SoC repo) Scalable Sample Rate
|
||||
AOT_AAC_LTP, ///< N (code in SoC repo) Long Term Prediction
|
||||
AOT_SBR, ///< N (in progress) Spectral Band Replication
|
||||
AOT_AAC_SCALABLE, ///< N Scalable
|
||||
AOT_TWINVQ, ///< N Twin Vector Quantizer
|
||||
AOT_CELP, ///< N Code Excited Linear Prediction
|
||||
AOT_HVXC, ///< N Harmonic Vector eXcitation Coding
|
||||
AOT_TTSI = 12, ///< N Text-To-Speech Interface
|
||||
AOT_MAINSYNTH, ///< N Main Synthesis
|
||||
AOT_WAVESYNTH, ///< N Wavetable Synthesis
|
||||
AOT_MIDI, ///< N General MIDI
|
||||
AOT_SAFX, ///< N Algorithmic Synthesis and Audio Effects
|
||||
AOT_ER_AAC_LC, ///< N Error Resilient Low Complexity
|
||||
AOT_ER_AAC_LTP = 19, ///< N Error Resilient Long Term Prediction
|
||||
AOT_ER_AAC_SCALABLE, ///< N Error Resilient Scalable
|
||||
AOT_ER_TWINVQ, ///< N Error Resilient Twin Vector Quantizer
|
||||
AOT_ER_BSAC, ///< N Error Resilient Bit-Sliced Arithmetic Coding
|
||||
AOT_ER_AAC_LD, ///< N Error Resilient Low Delay
|
||||
AOT_ER_CELP, ///< N Error Resilient Code Excited Linear Prediction
|
||||
AOT_ER_HVXC, ///< N Error Resilient Harmonic Vector eXcitation Coding
|
||||
AOT_ER_HILN, ///< N Error Resilient Harmonic and Individual Lines plus Noise
|
||||
AOT_ER_PARAM, ///< N Error Resilient Parametric
|
||||
AOT_SSC, ///< N SinuSoidal Coding
|
||||
};
|
||||
|
||||
enum RawDataBlockType {
|
||||
TYPE_SCE,
|
||||
TYPE_CPE,
|
||||
TYPE_CCE,
|
||||
TYPE_LFE,
|
||||
TYPE_DSE,
|
||||
TYPE_PCE,
|
||||
TYPE_FIL,
|
||||
TYPE_END,
|
||||
};
|
||||
|
||||
enum ExtensionPayloadID {
|
||||
EXT_FILL,
|
||||
EXT_FILL_DATA,
|
||||
EXT_DATA_ELEMENT,
|
||||
EXT_DYNAMIC_RANGE = 0xb,
|
||||
EXT_SBR_DATA = 0xd,
|
||||
EXT_SBR_DATA_CRC = 0xe,
|
||||
};
|
||||
|
||||
enum WindowSequence {
|
||||
ONLY_LONG_SEQUENCE,
|
||||
LONG_START_SEQUENCE,
|
||||
EIGHT_SHORT_SEQUENCE,
|
||||
LONG_STOP_SEQUENCE,
|
||||
};
|
||||
|
||||
enum BandType {
|
||||
ZERO_BT = 0, ///< Scalefactors and spectral data are all zero.
|
||||
FIRST_PAIR_BT = 5, ///< This and later band types encode two values (rather than four) with one code word.
|
||||
ESC_BT = 11, ///< Spectral data are coded with an escape sequence.
|
||||
NOISE_BT = 13, ///< Spectral data are scaled white noise not coded in the bitstream.
|
||||
INTENSITY_BT2 = 14, ///< Scalefactor data are intensity stereo positions.
|
||||
INTENSITY_BT = 15, ///< Scalefactor data are intensity stereo positions.
|
||||
};
|
||||
|
||||
#define IS_CODEBOOK_UNSIGNED(x) ((x - 1) & 10)
|
||||
|
||||
enum ChannelPosition {
|
||||
AAC_CHANNEL_FRONT = 1,
|
||||
AAC_CHANNEL_SIDE = 2,
|
||||
AAC_CHANNEL_BACK = 3,
|
||||
AAC_CHANNEL_LFE = 4,
|
||||
AAC_CHANNEL_CC = 5,
|
||||
};
|
||||
|
||||
/**
|
||||
* The point during decoding at which channel coupling is applied.
|
||||
*/
|
||||
enum CouplingPoint {
|
||||
BEFORE_TNS,
|
||||
BETWEEN_TNS_AND_IMDCT,
|
||||
AFTER_IMDCT = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* Predictor State
|
||||
*/
|
||||
typedef struct {
|
||||
float cor0;
|
||||
float cor1;
|
||||
float var0;
|
||||
float var1;
|
||||
float r0;
|
||||
float r1;
|
||||
} PredictorState;
|
||||
|
||||
#define MAX_PREDICTORS 672
|
||||
|
||||
/**
|
||||
* Individual Channel Stream
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t max_sfb; ///< number of scalefactor bands per group
|
||||
enum WindowSequence window_sequence[2];
|
||||
uint8_t use_kb_window[2]; ///< If set, use Kaiser-Bessel window, otherwise use a sinus window.
|
||||
int num_window_groups;
|
||||
uint8_t group_len[8];
|
||||
const uint16_t *swb_offset; ///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window
|
||||
int num_swb; ///< number of scalefactor window bands
|
||||
int num_windows;
|
||||
int tns_max_bands;
|
||||
int predictor_present;
|
||||
int predictor_initialized;
|
||||
int predictor_reset_group;
|
||||
uint8_t prediction_used[41];
|
||||
} IndividualChannelStream;
|
||||
|
||||
/**
|
||||
* Temporal Noise Shaping
|
||||
*/
|
||||
typedef struct {
|
||||
int present;
|
||||
int n_filt[8];
|
||||
int length[8][4];
|
||||
int direction[8][4];
|
||||
int order[8][4];
|
||||
float coef[8][4][TNS_MAX_ORDER];
|
||||
} TemporalNoiseShaping;
|
||||
|
||||
/**
|
||||
* Dynamic Range Control - decoded from the bitstream but not processed further.
|
||||
*/
|
||||
typedef struct {
|
||||
int pce_instance_tag; ///< Indicates with which program the DRC info is associated.
|
||||
int dyn_rng_sgn[17]; ///< DRC sign information; 0 - positive, 1 - negative
|
||||
int dyn_rng_ctl[17]; ///< DRC magnitude information
|
||||
int exclude_mask[MAX_CHANNELS]; ///< Channels to be excluded from DRC processing.
|
||||
int band_incr; ///< Number of DRC bands greater than 1 having DRC info.
|
||||
int interpolation_scheme; ///< Indicates the interpolation scheme used in the SBR QMF domain.
|
||||
int band_top[17]; ///< Indicates the top of the i-th DRC band in units of 4 spectral lines.
|
||||
int prog_ref_level; /**< A reference level for the long-term program audio level for all
|
||||
* channels combined.
|
||||
*/
|
||||
} DynamicRangeControl;
|
||||
|
||||
typedef struct {
|
||||
int num_pulse;
|
||||
int pos[4];
|
||||
int amp[4];
|
||||
} Pulse;
|
||||
|
||||
/**
|
||||
* coupling parameters
|
||||
*/
|
||||
typedef struct {
|
||||
enum CouplingPoint coupling_point; ///< The point during decoding at which coupling is applied.
|
||||
int num_coupled; ///< number of target elements
|
||||
enum RawDataBlockType type[8]; ///< Type of channel element to be coupled - SCE or CPE.
|
||||
int id_select[8]; ///< element id
|
||||
int ch_select[8]; /**< [0] shared list of gains; [1] list of gains for right channel;
|
||||
* [2] list of gains for left channel; [3] lists of gains for both channels
|
||||
*/
|
||||
float gain[16][120];
|
||||
} ChannelCoupling;
|
||||
|
||||
/**
|
||||
* Single Channel Element - used for both SCE and LFE elements.
|
||||
*/
|
||||
typedef struct {
|
||||
IndividualChannelStream ics;
|
||||
TemporalNoiseShaping tns;
|
||||
enum BandType band_type[120]; ///< band types
|
||||
int band_type_run_end[120]; ///< band type run end points
|
||||
float sf[120]; ///< scalefactors
|
||||
DECLARE_ALIGNED_16(float, coeffs[1024]); ///< coefficients for IMDCT
|
||||
DECLARE_ALIGNED_16(float, saved[512]); ///< overlap
|
||||
DECLARE_ALIGNED_16(float, ret[1024]); ///< PCM output
|
||||
PredictorState predictor_state[MAX_PREDICTORS];
|
||||
} SingleChannelElement;
|
||||
|
||||
/**
|
||||
* channel element - generic struct for SCE/CPE/CCE/LFE
|
||||
*/
|
||||
typedef struct {
|
||||
// CPE specific
|
||||
uint8_t ms_mask[120]; ///< Set if mid/side stereo is used for each scalefactor window band
|
||||
// shared
|
||||
SingleChannelElement ch[2];
|
||||
// CCE specific
|
||||
ChannelCoupling coup;
|
||||
} ChannelElement;
|
||||
|
||||
/**
|
||||
* main AAC context
|
||||
*/
|
||||
typedef struct {
|
||||
AVCodecContext * avccontext;
|
||||
|
||||
MPEG4AudioConfig m4ac;
|
||||
|
||||
int is_saved; ///< Set if elements have stored overlap from previous frame.
|
||||
DynamicRangeControl che_drc;
|
||||
|
||||
/**
|
||||
* @defgroup elements Channel element related data.
|
||||
* @{
|
||||
*/
|
||||
enum ChannelPosition che_pos[4][MAX_ELEM_ID]; /**< channel element channel mapping with the
|
||||
* first index as the first 4 raw data block types
|
||||
*/
|
||||
ChannelElement * che[4][MAX_ELEM_ID];
|
||||
ChannelElement * tag_che_map[4][MAX_ELEM_ID];
|
||||
int tags_mapped;
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup temporary aligned temporary buffers (We do not want to have these on the stack.)
|
||||
* @{
|
||||
*/
|
||||
DECLARE_ALIGNED_16(float, buf_mdct[1024]);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup tables Computed / set up during initialization.
|
||||
* @{
|
||||
*/
|
||||
MDCTContext mdct;
|
||||
MDCTContext mdct_small;
|
||||
DSPContext dsp;
|
||||
int random_state;
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup output Members used for output interleaving.
|
||||
* @{
|
||||
*/
|
||||
float *output_data[MAX_CHANNELS]; ///< Points to each element's 'ret' buffer (PCM output).
|
||||
float add_bias; ///< offset for dsp.float_to_int16
|
||||
float sf_scale; ///< Pre-scale for correct IMDCT and dsp.float_to_int16.
|
||||
int sf_offset; ///< offset into pow2sf_tab as appropriate for dsp.float_to_int16
|
||||
/** @} */
|
||||
|
||||
DECLARE_ALIGNED(16, float, temp[128]);
|
||||
} AACContext;
|
||||
|
||||
#endif /* AVCODEC_AAC_H */
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Common AAC and AC-3 parser
|
||||
* Copyright (c) 2003 Fabrice Bellard
|
||||
* Copyright (c) 2003 Michael Niedermayer
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "parser.h"
|
||||
#include "aac_ac3_parser.h"
|
||||
|
||||
int ff_aac_ac3_parse(AVCodecParserContext *s1,
|
||||
AVCodecContext *avctx,
|
||||
const uint8_t **poutbuf, int *poutbuf_size,
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
AACAC3ParseContext *s = s1->priv_data;
|
||||
ParseContext *pc = &s->pc;
|
||||
int len, i;
|
||||
int new_frame_start;
|
||||
|
||||
get_next:
|
||||
i=END_NOT_FOUND;
|
||||
if(s->remaining_size <= buf_size){
|
||||
if(s->remaining_size && !s->need_next_header){
|
||||
i= s->remaining_size;
|
||||
s->remaining_size = 0;
|
||||
}else{ //we need a header first
|
||||
len=0;
|
||||
for(i=s->remaining_size; i<buf_size; i++){
|
||||
s->state = (s->state<<8) + buf[i];
|
||||
if((len=s->sync(s->state, s, &s->need_next_header, &new_frame_start)))
|
||||
break;
|
||||
}
|
||||
if(len<=0){
|
||||
i=END_NOT_FOUND;
|
||||
}else{
|
||||
s->state=0;
|
||||
i-= s->header_size -1;
|
||||
s->remaining_size = len;
|
||||
if(!new_frame_start || pc->index+i<=0){
|
||||
s->remaining_size += i;
|
||||
goto get_next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ff_combine_frame(pc, i, &buf, &buf_size)<0){
|
||||
s->remaining_size -= FFMIN(s->remaining_size, buf_size);
|
||||
*poutbuf = NULL;
|
||||
*poutbuf_size = 0;
|
||||
return buf_size;
|
||||
}
|
||||
|
||||
*poutbuf = buf;
|
||||
*poutbuf_size = buf_size;
|
||||
|
||||
/* update codec info */
|
||||
avctx->sample_rate = s->sample_rate;
|
||||
if(s->codec_id)
|
||||
avctx->codec_id = s->codec_id;
|
||||
|
||||
/* allow downmixing to stereo (or mono for AC-3) */
|
||||
if(avctx->request_channels > 0 &&
|
||||
avctx->request_channels < s->channels &&
|
||||
(avctx->request_channels <= 2 ||
|
||||
(avctx->request_channels == 1 &&
|
||||
(avctx->codec_id == CODEC_ID_AC3 ||
|
||||
avctx->codec_id == CODEC_ID_EAC3)))) {
|
||||
avctx->channels = avctx->request_channels;
|
||||
} else {
|
||||
avctx->channels = s->channels;
|
||||
}
|
||||
avctx->bit_rate = s->bit_rate;
|
||||
avctx->frame_size = s->samples;
|
||||
|
||||
return i;
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Common AAC and AC-3 parser prototypes
|
||||
* Copyright (c) 2003 Fabrice Bellard
|
||||
* Copyright (c) 2003 Michael Niedermayer
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AAC_AC3_PARSER_H
|
||||
#define AVCODEC_AAC_AC3_PARSER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "avcodec.h"
|
||||
#include "parser.h"
|
||||
|
||||
typedef enum {
|
||||
AAC_AC3_PARSE_ERROR_SYNC = -1,
|
||||
AAC_AC3_PARSE_ERROR_BSID = -2,
|
||||
AAC_AC3_PARSE_ERROR_SAMPLE_RATE = -3,
|
||||
AAC_AC3_PARSE_ERROR_FRAME_SIZE = -4,
|
||||
AAC_AC3_PARSE_ERROR_FRAME_TYPE = -5,
|
||||
AAC_AC3_PARSE_ERROR_CRC = -6,
|
||||
AAC_AC3_PARSE_ERROR_CHANNEL_CFG = -7,
|
||||
} AACAC3ParseError;
|
||||
|
||||
typedef struct AACAC3ParseContext {
|
||||
ParseContext pc;
|
||||
int frame_size;
|
||||
int header_size;
|
||||
int (*sync)(uint64_t state, struct AACAC3ParseContext *hdr_info,
|
||||
int *need_next_header, int *new_frame_start);
|
||||
|
||||
int channels;
|
||||
int sample_rate;
|
||||
int bit_rate;
|
||||
int samples;
|
||||
|
||||
int remaining_size;
|
||||
uint64_t state;
|
||||
|
||||
int need_next_header;
|
||||
enum CodecID codec_id;
|
||||
} AACAC3ParseContext;
|
||||
|
||||
int ff_aac_ac3_parse(AVCodecParserContext *s1,
|
||||
AVCodecContext *avctx,
|
||||
const uint8_t **poutbuf, int *poutbuf_size,
|
||||
const uint8_t *buf, int buf_size);
|
||||
|
||||
#endif /* AVCODEC_AAC_AC3_PARSER_H */
|
||||
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Audio and Video frame extraction
|
||||
* Copyright (c) 2003 Fabrice Bellard
|
||||
* Copyright (c) 2003 Michael Niedermayer
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "parser.h"
|
||||
#include "aac_ac3_parser.h"
|
||||
#include "aac_parser.h"
|
||||
#include "bitstream.h"
|
||||
#include "mpeg4audio.h"
|
||||
|
||||
#define AAC_HEADER_SIZE 7
|
||||
|
||||
int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
|
||||
{
|
||||
int size, rdb, ch, sr;
|
||||
int aot, crc_abs;
|
||||
|
||||
if(get_bits(gbc, 12) != 0xfff)
|
||||
return AAC_AC3_PARSE_ERROR_SYNC;
|
||||
|
||||
skip_bits1(gbc); /* id */
|
||||
skip_bits(gbc, 2); /* layer */
|
||||
crc_abs = get_bits1(gbc); /* protection_absent */
|
||||
aot = get_bits(gbc, 2); /* profile_objecttype */
|
||||
sr = get_bits(gbc, 4); /* sample_frequency_index */
|
||||
if(!ff_mpeg4audio_sample_rates[sr])
|
||||
return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
|
||||
skip_bits1(gbc); /* private_bit */
|
||||
ch = get_bits(gbc, 3); /* channel_configuration */
|
||||
|
||||
if(!ff_mpeg4audio_channels[ch])
|
||||
return AAC_AC3_PARSE_ERROR_CHANNEL_CFG;
|
||||
|
||||
skip_bits1(gbc); /* original/copy */
|
||||
skip_bits1(gbc); /* home */
|
||||
|
||||
/* adts_variable_header */
|
||||
skip_bits1(gbc); /* copyright_identification_bit */
|
||||
skip_bits1(gbc); /* copyright_identification_start */
|
||||
size = get_bits(gbc, 13); /* aac_frame_length */
|
||||
if(size < AAC_HEADER_SIZE)
|
||||
return AAC_AC3_PARSE_ERROR_FRAME_SIZE;
|
||||
|
||||
skip_bits(gbc, 11); /* adts_buffer_fullness */
|
||||
rdb = get_bits(gbc, 2); /* number_of_raw_data_blocks_in_frame */
|
||||
|
||||
hdr->object_type = aot + 1;
|
||||
hdr->chan_config = ch;
|
||||
hdr->crc_absent = crc_abs;
|
||||
hdr->num_aac_frames = rdb + 1;
|
||||
hdr->sampling_index = sr;
|
||||
hdr->sample_rate = ff_mpeg4audio_sample_rates[sr];
|
||||
hdr->samples = (rdb + 1) * 1024;
|
||||
hdr->bit_rate = size * 8 * hdr->sample_rate / hdr->samples;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
|
||||
int *need_next_header, int *new_frame_start)
|
||||
{
|
||||
GetBitContext bits;
|
||||
AACADTSHeaderInfo hdr;
|
||||
int size;
|
||||
union {
|
||||
uint64_t u64;
|
||||
uint8_t u8[8];
|
||||
} tmp;
|
||||
|
||||
tmp.u64 = be2me_64(state);
|
||||
init_get_bits(&bits, tmp.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8);
|
||||
|
||||
if ((size = ff_aac_parse_header(&bits, &hdr)) < 0)
|
||||
return 0;
|
||||
*need_next_header = 0;
|
||||
*new_frame_start = 1;
|
||||
hdr_info->sample_rate = hdr.sample_rate;
|
||||
hdr_info->channels = ff_mpeg4audio_channels[hdr.chan_config];
|
||||
hdr_info->samples = hdr.samples;
|
||||
hdr_info->bit_rate = hdr.bit_rate;
|
||||
return size;
|
||||
}
|
||||
|
||||
static av_cold int aac_parse_init(AVCodecParserContext *s1)
|
||||
{
|
||||
AACAC3ParseContext *s = s1->priv_data;
|
||||
s->header_size = AAC_HEADER_SIZE;
|
||||
s->sync = aac_sync;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
AVCodecParser aac_parser = {
|
||||
{ CODEC_ID_AAC },
|
||||
sizeof(AACAC3ParseContext),
|
||||
aac_parse_init,
|
||||
ff_aac_ac3_parse,
|
||||
ff_parse_close,
|
||||
};
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* AAC parser prototypes
|
||||
* Copyright (c) 2003 Fabrice Bellard
|
||||
* Copyright (c) 2003 Michael Niedermayer
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AAC_PARSER_H
|
||||
#define AVCODEC_AAC_PARSER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "aac_ac3_parser.h"
|
||||
#include "bitstream.h"
|
||||
|
||||
typedef struct {
|
||||
uint32_t sample_rate;
|
||||
uint32_t samples;
|
||||
uint32_t bit_rate;
|
||||
uint8_t crc_absent;
|
||||
uint8_t object_type;
|
||||
uint8_t sampling_index;
|
||||
uint8_t chan_config;
|
||||
uint8_t num_aac_frames;
|
||||
} AACADTSHeaderInfo;
|
||||
|
||||
/**
|
||||
* Parses AAC frame header.
|
||||
* Parses the ADTS frame header to the end of the variable header, which is
|
||||
* the first 54 bits.
|
||||
* @param gbc[in] BitContext containing the first 54 bits of the frame.
|
||||
* @param hdr[out] Pointer to struct where header info is written.
|
||||
* @return Returns 0 on success, -1 if there is a sync word mismatch,
|
||||
* -2 if the version element is invalid, -3 if the sample rate
|
||||
* element is invalid, or -4 if the bit rate element is invalid.
|
||||
*/
|
||||
int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr);
|
||||
|
||||
#endif /* AVCODEC_AAC_PARSER_H */
|
||||
@@ -1,211 +0,0 @@
|
||||
/*
|
||||
* AAC decoder data
|
||||
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
|
||||
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/aacdectab.h
|
||||
* AAC decoder data
|
||||
* @author Oded Shimon ( ods15 ods15 dyndns org )
|
||||
* @author Maxim Gavrilov ( maxim.gavrilov gmail com )
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AACDECTAB_H
|
||||
#define AVCODEC_AACDECTAB_H
|
||||
|
||||
#include "aac.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* @name swb_offsets
|
||||
* Sample offset into the window indicating the beginning of a scalefactor
|
||||
* window band
|
||||
*
|
||||
* scalefactor window band - term for scalefactor bands within a window,
|
||||
* given in Table 4.110 to Table 4.128.
|
||||
*
|
||||
* scalefactor band - a set of spectral coefficients which are scaled by one
|
||||
* scalefactor. In case of EIGHT_SHORT_SEQUENCE and grouping a scalefactor band
|
||||
* may contain several scalefactor window bands of corresponding frequency. For
|
||||
* all other window_sequences scalefactor bands and scalefactor window bands are
|
||||
* identical.
|
||||
* @{
|
||||
*/
|
||||
|
||||
static const uint16_t swb_offset_1024_96[] = {
|
||||
0, 4, 8, 12, 16, 20, 24, 28,
|
||||
32, 36, 40, 44, 48, 52, 56, 64,
|
||||
72, 80, 88, 96, 108, 120, 132, 144,
|
||||
156, 172, 188, 212, 240, 276, 320, 384,
|
||||
448, 512, 576, 640, 704, 768, 832, 896,
|
||||
960, 1024
|
||||
};
|
||||
|
||||
static const uint16_t swb_offset_128_96[] = {
|
||||
0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128
|
||||
};
|
||||
|
||||
static const uint16_t swb_offset_1024_64[] = {
|
||||
0, 4, 8, 12, 16, 20, 24, 28,
|
||||
32, 36, 40, 44, 48, 52, 56, 64,
|
||||
72, 80, 88, 100, 112, 124, 140, 156,
|
||||
172, 192, 216, 240, 268, 304, 344, 384,
|
||||
424, 464, 504, 544, 584, 624, 664, 704,
|
||||
744, 784, 824, 864, 904, 944, 984, 1024
|
||||
};
|
||||
|
||||
static const uint16_t swb_offset_1024_48[] = {
|
||||
0, 4, 8, 12, 16, 20, 24, 28,
|
||||
32, 36, 40, 48, 56, 64, 72, 80,
|
||||
88, 96, 108, 120, 132, 144, 160, 176,
|
||||
196, 216, 240, 264, 292, 320, 352, 384,
|
||||
416, 448, 480, 512, 544, 576, 608, 640,
|
||||
672, 704, 736, 768, 800, 832, 864, 896,
|
||||
928, 1024
|
||||
};
|
||||
|
||||
static const uint16_t swb_offset_128_48[] = {
|
||||
0, 4, 8, 12, 16, 20, 28, 36,
|
||||
44, 56, 68, 80, 96, 112, 128
|
||||
};
|
||||
|
||||
static const uint16_t swb_offset_1024_32[] = {
|
||||
0, 4, 8, 12, 16, 20, 24, 28,
|
||||
32, 36, 40, 48, 56, 64, 72, 80,
|
||||
88, 96, 108, 120, 132, 144, 160, 176,
|
||||
196, 216, 240, 264, 292, 320, 352, 384,
|
||||
416, 448, 480, 512, 544, 576, 608, 640,
|
||||
672, 704, 736, 768, 800, 832, 864, 896,
|
||||
928, 960, 992, 1024
|
||||
};
|
||||
|
||||
static const uint16_t swb_offset_1024_24[] = {
|
||||
0, 4, 8, 12, 16, 20, 24, 28,
|
||||
32, 36, 40, 44, 52, 60, 68, 76,
|
||||
84, 92, 100, 108, 116, 124, 136, 148,
|
||||
160, 172, 188, 204, 220, 240, 260, 284,
|
||||
308, 336, 364, 396, 432, 468, 508, 552,
|
||||
600, 652, 704, 768, 832, 896, 960, 1024
|
||||
};
|
||||
|
||||
static const uint16_t swb_offset_128_24[] = {
|
||||
0, 4, 8, 12, 16, 20, 24, 28,
|
||||
36, 44, 52, 64, 76, 92, 108, 128
|
||||
};
|
||||
|
||||
static const uint16_t swb_offset_1024_16[] = {
|
||||
0, 8, 16, 24, 32, 40, 48, 56,
|
||||
64, 72, 80, 88, 100, 112, 124, 136,
|
||||
148, 160, 172, 184, 196, 212, 228, 244,
|
||||
260, 280, 300, 320, 344, 368, 396, 424,
|
||||
456, 492, 532, 572, 616, 664, 716, 772,
|
||||
832, 896, 960, 1024
|
||||
};
|
||||
|
||||
static const uint16_t swb_offset_128_16[] = {
|
||||
0, 4, 8, 12, 16, 20, 24, 28,
|
||||
32, 40, 48, 60, 72, 88, 108, 128
|
||||
};
|
||||
|
||||
static const uint16_t swb_offset_1024_8[] = {
|
||||
0, 12, 24, 36, 48, 60, 72, 84,
|
||||
96, 108, 120, 132, 144, 156, 172, 188,
|
||||
204, 220, 236, 252, 268, 288, 308, 328,
|
||||
348, 372, 396, 420, 448, 476, 508, 544,
|
||||
580, 620, 664, 712, 764, 820, 880, 944,
|
||||
1024
|
||||
};
|
||||
|
||||
static const uint16_t swb_offset_128_8[] = {
|
||||
0, 4, 8, 12, 16, 20, 24, 28,
|
||||
36, 44, 52, 60, 72, 88, 108, 128
|
||||
};
|
||||
|
||||
static const uint16_t *swb_offset_1024[] = {
|
||||
swb_offset_1024_96, swb_offset_1024_96, swb_offset_1024_64,
|
||||
swb_offset_1024_48, swb_offset_1024_48, swb_offset_1024_32,
|
||||
swb_offset_1024_24, swb_offset_1024_24, swb_offset_1024_16,
|
||||
swb_offset_1024_16, swb_offset_1024_16, swb_offset_1024_8,
|
||||
swb_offset_1024_8
|
||||
};
|
||||
|
||||
static const uint16_t *swb_offset_128[] = {
|
||||
/* The last entry on the following row is swb_offset_128_64 but is a
|
||||
duplicate of swb_offset_128_96. */
|
||||
swb_offset_128_96, swb_offset_128_96, swb_offset_128_96,
|
||||
swb_offset_128_48, swb_offset_128_48, swb_offset_128_48,
|
||||
swb_offset_128_24, swb_offset_128_24, swb_offset_128_16,
|
||||
swb_offset_128_16, swb_offset_128_16, swb_offset_128_8,
|
||||
swb_offset_128_8
|
||||
};
|
||||
|
||||
// @}
|
||||
|
||||
/* @name tns_max_bands
|
||||
* The maximum number of scalefactor bands on which TNS can operate for the long
|
||||
* and short transforms respectively. The index to these tables is related to
|
||||
* the sample rate of the audio.
|
||||
* @{
|
||||
*/
|
||||
static const uint8_t tns_max_bands_1024[] = {
|
||||
31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39, 39
|
||||
};
|
||||
|
||||
static const uint8_t tns_max_bands_128[] = {
|
||||
9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14
|
||||
};
|
||||
// @}
|
||||
|
||||
/* @name tns_tmp2_map
|
||||
* Tables of the tmp2[] arrays of LPC coefficients used for TNS.
|
||||
* The suffix _M_N[] indicate the values of coef_compress and coef_res
|
||||
* respectively.
|
||||
* @{
|
||||
*/
|
||||
static const float tns_tmp2_map_1_3[4] = {
|
||||
0.00000000, -0.43388373, 0.64278758, 0.34202015,
|
||||
};
|
||||
|
||||
static const float tns_tmp2_map_0_3[8] = {
|
||||
0.00000000, -0.43388373, -0.78183150, -0.97492790,
|
||||
0.98480773, 0.86602539, 0.64278758, 0.34202015,
|
||||
};
|
||||
|
||||
static const float tns_tmp2_map_1_4[8] = {
|
||||
0.00000000, -0.20791170, -0.40673664, -0.58778524,
|
||||
0.67369562, 0.52643216, 0.36124167, 0.18374951,
|
||||
};
|
||||
|
||||
static const float tns_tmp2_map_0_4[16] = {
|
||||
0.00000000, -0.20791170, -0.40673664, -0.58778524,
|
||||
-0.74314481, -0.86602539, -0.95105654, -0.99452192,
|
||||
0.99573416, 0.96182561, 0.89516330, 0.79801720,
|
||||
0.67369562, 0.52643216, 0.36124167, 0.18374951,
|
||||
};
|
||||
|
||||
static const float * const tns_tmp2_map[4] = {
|
||||
tns_tmp2_map_0_3,
|
||||
tns_tmp2_map_0_4,
|
||||
tns_tmp2_map_1_3,
|
||||
tns_tmp2_map_1_4
|
||||
};
|
||||
// @}
|
||||
|
||||
#endif /* AVCODEC_AACDECTAB_H */
|
||||
@@ -1,365 +0,0 @@
|
||||
/*
|
||||
* AAC encoder
|
||||
* Copyright (C) 2008 Konstantin Shishkov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/aacenc.c
|
||||
* AAC encoder
|
||||
*/
|
||||
|
||||
/***********************************
|
||||
* TODOs:
|
||||
* psy model selection with some option
|
||||
* add sane pulse detection
|
||||
* add temporal noise shaping
|
||||
***********************************/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "bitstream.h"
|
||||
#include "dsputil.h"
|
||||
#include "mpeg4audio.h"
|
||||
|
||||
#include "aacpsy.h"
|
||||
#include "aac.h"
|
||||
#include "aactab.h"
|
||||
|
||||
static const uint8_t swb_size_1024_96[] = {
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8,
|
||||
12, 12, 12, 12, 12, 16, 16, 24, 28, 36, 44,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
|
||||
};
|
||||
|
||||
static const uint8_t swb_size_1024_64[] = {
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8,
|
||||
12, 12, 12, 16, 16, 16, 20, 24, 24, 28, 36,
|
||||
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40
|
||||
};
|
||||
|
||||
static const uint8_t swb_size_1024_48[] = {
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8,
|
||||
12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28,
|
||||
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
96
|
||||
};
|
||||
|
||||
static const uint8_t swb_size_1024_32[] = {
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8,
|
||||
12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28,
|
||||
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
|
||||
};
|
||||
|
||||
static const uint8_t swb_size_1024_24[] = {
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
12, 12, 12, 12, 16, 16, 16, 20, 20, 24, 24, 28, 28,
|
||||
32, 36, 36, 40, 44, 48, 52, 52, 64, 64, 64, 64, 64
|
||||
};
|
||||
|
||||
static const uint8_t swb_size_1024_16[] = {
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
12, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24, 24, 28, 28,
|
||||
32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 64
|
||||
};
|
||||
|
||||
static const uint8_t swb_size_1024_8[] = {
|
||||
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
|
||||
16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 24, 24, 24, 28, 28,
|
||||
32, 36, 36, 40, 44, 48, 52, 56, 60, 64, 80
|
||||
};
|
||||
|
||||
static const uint8_t * const swb_size_1024[] = {
|
||||
swb_size_1024_96, swb_size_1024_96, swb_size_1024_64,
|
||||
swb_size_1024_48, swb_size_1024_48, swb_size_1024_32,
|
||||
swb_size_1024_24, swb_size_1024_24, swb_size_1024_16,
|
||||
swb_size_1024_16, swb_size_1024_16, swb_size_1024_8
|
||||
};
|
||||
|
||||
static const uint8_t swb_size_128_96[] = {
|
||||
4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 36
|
||||
};
|
||||
|
||||
static const uint8_t swb_size_128_48[] = {
|
||||
4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16
|
||||
};
|
||||
|
||||
static const uint8_t swb_size_128_24[] = {
|
||||
4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 16, 16, 20
|
||||
};
|
||||
|
||||
static const uint8_t swb_size_128_16[] = {
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 20
|
||||
};
|
||||
|
||||
static const uint8_t swb_size_128_8[] = {
|
||||
4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 16, 20, 20
|
||||
};
|
||||
|
||||
static const uint8_t * const swb_size_128[] = {
|
||||
/* the last entry on the following row is swb_size_128_64 but is a
|
||||
duplicate of swb_size_128_96 */
|
||||
swb_size_128_96, swb_size_128_96, swb_size_128_96,
|
||||
swb_size_128_48, swb_size_128_48, swb_size_128_48,
|
||||
swb_size_128_24, swb_size_128_24, swb_size_128_16,
|
||||
swb_size_128_16, swb_size_128_16, swb_size_128_8
|
||||
};
|
||||
|
||||
/** bits needed to code codebook run value for long windows */
|
||||
static const uint8_t run_value_bits_long[64] = {
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10,
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 15
|
||||
};
|
||||
|
||||
/** bits needed to code codebook run value for short windows */
|
||||
static const uint8_t run_value_bits_short[16] = {
|
||||
3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 9
|
||||
};
|
||||
|
||||
static const uint8_t* const run_value_bits[2] = {
|
||||
run_value_bits_long, run_value_bits_short
|
||||
};
|
||||
|
||||
/** default channel configurations */
|
||||
static const uint8_t aac_chan_configs[6][5] = {
|
||||
{1, TYPE_SCE}, // 1 channel - single channel element
|
||||
{1, TYPE_CPE}, // 2 channels - channel pair
|
||||
{2, TYPE_SCE, TYPE_CPE}, // 3 channels - center + stereo
|
||||
{3, TYPE_SCE, TYPE_CPE, TYPE_SCE}, // 4 channels - front center + stereo + back center
|
||||
{3, TYPE_SCE, TYPE_CPE, TYPE_CPE}, // 5 channels - front center + stereo + back stereo
|
||||
{4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE}, // 6 channels - front center + stereo + back stereo + LFE
|
||||
};
|
||||
|
||||
/**
|
||||
* structure used in optimal codebook search
|
||||
*/
|
||||
typedef struct BandCodingPath {
|
||||
int prev_idx; ///< pointer to the previous path point
|
||||
int codebook; ///< codebook for coding band run
|
||||
int bits; ///< number of bit needed to code given number of bands
|
||||
} BandCodingPath;
|
||||
|
||||
/**
|
||||
* AAC encoder context
|
||||
*/
|
||||
typedef struct {
|
||||
PutBitContext pb;
|
||||
MDCTContext mdct1024; ///< long (1024 samples) frame transform context
|
||||
MDCTContext mdct128; ///< short (128 samples) frame transform context
|
||||
DSPContext dsp;
|
||||
DECLARE_ALIGNED_16(FFTSample, output[2048]); ///< temporary buffer for MDCT input coefficients
|
||||
int16_t* samples; ///< saved preprocessed input
|
||||
|
||||
int samplerate_index; ///< MPEG-4 samplerate index
|
||||
|
||||
ChannelElement *cpe; ///< channel elements
|
||||
AACPsyContext psy; ///< psychoacoustic model context
|
||||
int last_frame;
|
||||
} AACEncContext;
|
||||
|
||||
/**
|
||||
* Make AAC audio config object.
|
||||
* @see 1.6.2.1 "Syntax - AudioSpecificConfig"
|
||||
*/
|
||||
static void put_audio_specific_config(AVCodecContext *avctx)
|
||||
{
|
||||
PutBitContext pb;
|
||||
AACEncContext *s = avctx->priv_data;
|
||||
|
||||
init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
|
||||
put_bits(&pb, 5, 2); //object type - AAC-LC
|
||||
put_bits(&pb, 4, s->samplerate_index); //sample rate index
|
||||
put_bits(&pb, 4, avctx->channels);
|
||||
//GASpecificConfig
|
||||
put_bits(&pb, 1, 0); //frame length - 1024 samples
|
||||
put_bits(&pb, 1, 0); //does not depend on core coder
|
||||
put_bits(&pb, 1, 0); //is not extension
|
||||
flush_put_bits(&pb);
|
||||
}
|
||||
|
||||
static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
{
|
||||
AACEncContext *s = avctx->priv_data;
|
||||
int i;
|
||||
|
||||
avctx->frame_size = 1024;
|
||||
|
||||
for(i = 0; i < 16; i++)
|
||||
if(avctx->sample_rate == ff_mpeg4audio_sample_rates[i])
|
||||
break;
|
||||
if(i == 16){
|
||||
av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate);
|
||||
return -1;
|
||||
}
|
||||
if(avctx->channels > 6){
|
||||
av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %d\n", avctx->channels);
|
||||
return -1;
|
||||
}
|
||||
s->samplerate_index = i;
|
||||
|
||||
dsputil_init(&s->dsp, avctx);
|
||||
ff_mdct_init(&s->mdct1024, 11, 0);
|
||||
ff_mdct_init(&s->mdct128, 8, 0);
|
||||
// window init
|
||||
ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
|
||||
ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);
|
||||
ff_sine_window_init(ff_sine_1024, 1024);
|
||||
ff_sine_window_init(ff_sine_128, 128);
|
||||
|
||||
s->samples = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0]));
|
||||
s->cpe = av_mallocz(sizeof(ChannelElement) * aac_chan_configs[avctx->channels-1][0]);
|
||||
if(ff_aac_psy_init(&s->psy, avctx, AAC_PSY_3GPP,
|
||||
aac_chan_configs[avctx->channels-1][0], 0,
|
||||
swb_size_1024[i], ff_aac_num_swb_1024[i], swb_size_128[i], ff_aac_num_swb_128[i]) < 0){
|
||||
av_log(avctx, AV_LOG_ERROR, "Cannot initialize selected model.\n");
|
||||
return -1;
|
||||
}
|
||||
avctx->extradata = av_malloc(2);
|
||||
avctx->extradata_size = 2;
|
||||
put_audio_specific_config(avctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode ics_info element.
|
||||
* @see Table 4.6 (syntax of ics_info)
|
||||
*/
|
||||
static void put_ics_info(AACEncContext *s, IndividualChannelStream *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
put_bits(&s->pb, 1, 0); // ics_reserved bit
|
||||
put_bits(&s->pb, 2, info->window_sequence[0]);
|
||||
put_bits(&s->pb, 1, info->use_kb_window[0]);
|
||||
if(info->window_sequence[0] != EIGHT_SHORT_SEQUENCE){
|
||||
put_bits(&s->pb, 6, info->max_sfb);
|
||||
put_bits(&s->pb, 1, 0); // no prediction
|
||||
}else{
|
||||
put_bits(&s->pb, 4, info->max_sfb);
|
||||
for(i = 1; i < info->num_windows; i++)
|
||||
put_bits(&s->pb, 1, info->group_len[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the number of bits needed to code all coefficient signs in current band.
|
||||
*/
|
||||
static int calculate_band_sign_bits(AACEncContext *s, SingleChannelElement *sce,
|
||||
int group_len, int start, int size)
|
||||
{
|
||||
int bits = 0;
|
||||
int i, w;
|
||||
for(w = 0; w < group_len; w++){
|
||||
for(i = 0; i < size; i++){
|
||||
if(sce->icoefs[start + i])
|
||||
bits++;
|
||||
}
|
||||
start += 128;
|
||||
}
|
||||
return bits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode pulse data.
|
||||
*/
|
||||
static void encode_pulses(AACEncContext *s, Pulse *pulse)
|
||||
{
|
||||
int i;
|
||||
|
||||
put_bits(&s->pb, 1, !!pulse->num_pulse);
|
||||
if(!pulse->num_pulse) return;
|
||||
|
||||
put_bits(&s->pb, 2, pulse->num_pulse - 1);
|
||||
put_bits(&s->pb, 6, pulse->start);
|
||||
for(i = 0; i < pulse->num_pulse; i++){
|
||||
put_bits(&s->pb, 5, pulse->pos[i]);
|
||||
put_bits(&s->pb, 4, pulse->amp[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode spectral coefficients processed by psychoacoustic model.
|
||||
*/
|
||||
static void encode_spectral_coeffs(AACEncContext *s, SingleChannelElement *sce)
|
||||
{
|
||||
int start, i, w, w2, wg;
|
||||
|
||||
w = 0;
|
||||
for(wg = 0; wg < sce->ics.num_window_groups; wg++){
|
||||
start = 0;
|
||||
for(i = 0; i < sce->ics.max_sfb; i++){
|
||||
if(sce->zeroes[w*16 + i]){
|
||||
start += sce->ics.swb_sizes[i];
|
||||
continue;
|
||||
}
|
||||
for(w2 = w; w2 < w + sce->ics.group_len[wg]; w2++){
|
||||
encode_band_coeffs(s, sce, start + w2*128,
|
||||
sce->ics.swb_sizes[i],
|
||||
sce->band_type[w*16 + i]);
|
||||
}
|
||||
start += sce->ics.swb_sizes[i];
|
||||
}
|
||||
w += sce->ics.group_len[wg];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write some auxiliary information about the created AAC file.
|
||||
*/
|
||||
static void put_bitstream_info(AVCodecContext *avctx, AACEncContext *s, const char *name)
|
||||
{
|
||||
int i, namelen, padbits;
|
||||
|
||||
namelen = strlen(name) + 2;
|
||||
put_bits(&s->pb, 3, TYPE_FIL);
|
||||
put_bits(&s->pb, 4, FFMIN(namelen, 15));
|
||||
if(namelen >= 15)
|
||||
put_bits(&s->pb, 8, namelen - 16);
|
||||
put_bits(&s->pb, 4, 0); //extension type - filler
|
||||
padbits = 8 - (put_bits_count(&s->pb) & 7);
|
||||
align_put_bits(&s->pb);
|
||||
for(i = 0; i < namelen - 2; i++)
|
||||
put_bits(&s->pb, 8, name[i]);
|
||||
put_bits(&s->pb, 12 - padbits, 0);
|
||||
}
|
||||
|
||||
static av_cold int aac_encode_end(AVCodecContext *avctx)
|
||||
{
|
||||
AACEncContext *s = avctx->priv_data;
|
||||
|
||||
ff_mdct_end(&s->mdct1024);
|
||||
ff_mdct_end(&s->mdct128);
|
||||
ff_aac_psy_end(&s->psy);
|
||||
av_freep(&s->samples);
|
||||
av_freep(&s->cpe);
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVCodec aac_encoder = {
|
||||
"aac",
|
||||
CODEC_TYPE_AUDIO,
|
||||
CODEC_ID_AAC,
|
||||
sizeof(AACEncContext),
|
||||
aac_encode_init,
|
||||
aac_encode_frame,
|
||||
aac_encode_end,
|
||||
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
|
||||
.sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
|
||||
};
|
||||
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* AAC encoder psychoacoustic model
|
||||
* Copyright (C) 2008 Konstantin Shishkov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/aacpsy.c
|
||||
* AAC encoder psychoacoustic model
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "aacpsy.h"
|
||||
#include "aactab.h"
|
||||
|
||||
/***********************************
|
||||
* TODOs:
|
||||
* General:
|
||||
* better audio preprocessing (add DC highpass filter?)
|
||||
* more psy models
|
||||
* maybe improve coefficient quantization function in some way
|
||||
*
|
||||
* 3GPP-based psy model:
|
||||
* thresholds linearization after their modifications for attaining given bitrate
|
||||
* try other bitrate controlling mechanism (maybe use ratecontrol.c?)
|
||||
* control quality for quality-based output
|
||||
**********************************/
|
||||
|
||||
/**
|
||||
* Quantize one coefficient.
|
||||
* @return absolute value of the quantized coefficient
|
||||
* @see 3GPP TS26.403 5.6.2 "Scalefactor determination"
|
||||
*/
|
||||
static av_always_inline int quant(float coef, const float Q)
|
||||
{
|
||||
return av_clip((int)(pow(fabsf(coef) * Q, 0.75) + 0.4054), 0, 8191);
|
||||
}
|
||||
|
||||
static inline float get_approximate_quant_error(float *c, int size, int scale_idx)
|
||||
{
|
||||
int i;
|
||||
int q;
|
||||
float coef, unquant, sum = 0.0f;
|
||||
const float Q = ff_aac_pow2sf_tab[200 - scale_idx + SCALE_ONE_POS - SCALE_DIV_512];
|
||||
const float IQ = ff_aac_pow2sf_tab[200 + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
|
||||
for(i = 0; i < size; i++){
|
||||
coef = fabs(c[i]);
|
||||
q = quant(c[i], Q);
|
||||
unquant = (q * cbrt(q)) * IQ;
|
||||
sum += (coef - unquant) * (coef - unquant);
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* constants for 3GPP AAC psychoacoustic model
|
||||
* @{
|
||||
*/
|
||||
#define PSY_3GPP_SPREAD_LOW 1.5f // spreading factor for ascending threshold spreading (15 dB/Bark)
|
||||
#define PSY_3GPP_SPREAD_HI 3.0f // spreading factor for descending threshold spreading (30 dB/Bark)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* information for single band used by 3GPP TS26.403-inspired psychoacoustic model
|
||||
*/
|
||||
typedef struct Psy3gppBand{
|
||||
float energy; ///< band energy
|
||||
float ffac; ///< form factor
|
||||
}Psy3gppBand;
|
||||
|
||||
/**
|
||||
* psychoacoustic model frame type-dependent coefficients
|
||||
*/
|
||||
typedef struct Psy3gppCoeffs{
|
||||
float ath [64]; ///< absolute threshold of hearing per bands
|
||||
float barks [64]; ///< Bark value for each spectral band in long frame
|
||||
float spread_low[64]; ///< spreading factor for low-to-high threshold spreading in long frame
|
||||
float spread_hi [64]; ///< spreading factor for high-to-low threshold spreading in long frame
|
||||
}Psy3gppCoeffs;
|
||||
|
||||
/**
|
||||
* Calculate Bark value for given line.
|
||||
*/
|
||||
static inline float calc_bark(float f)
|
||||
{
|
||||
return 13.3f * atanf(0.00076f * f) + 3.5f * atanf((f / 7500.0f) * (f / 7500.0f));
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* AAC encoder psychoacoustic model
|
||||
* Copyright (C) 2008 Konstantin Shishkov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AACPSY_H
|
||||
#define AVCODEC_AACPSY_H
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "aac.h"
|
||||
//#include "lowpass.h"
|
||||
|
||||
enum AACPsyModelType{
|
||||
AAC_PSY_TEST, ///< a sample model to exercise encoder
|
||||
AAC_PSY_3GPP, ///< model following recommendations from 3GPP TS 26.403
|
||||
|
||||
AAC_NB_PSY_MODELS ///< total number of psychoacoustic models, since it's not a part of the ABI new models can be added freely
|
||||
};
|
||||
|
||||
/**
|
||||
* context used by psychoacoustic model
|
||||
*/
|
||||
typedef struct AACPsyContext {
|
||||
AVCodecContext *avctx; ///< encoder context
|
||||
}AACPsyContext;
|
||||
|
||||
/**
|
||||
* Cleanup model context at the end.
|
||||
*
|
||||
* @param ctx model context
|
||||
*/
|
||||
void ff_aac_psy_end(AACPsyContext *ctx);
|
||||
|
||||
#endif /* AVCODEC_AACPSY_H */
|
||||
-1025
File diff suppressed because it is too large
Load Diff
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* AAC data declarations
|
||||
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
|
||||
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/aactab.h
|
||||
* AAC data declarations
|
||||
* @author Oded Shimon ( ods15 ods15 dyndns org )
|
||||
* @author Maxim Gavrilov ( maxim.gavrilov gmail com )
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AACTAB_H
|
||||
#define AVCODEC_AACTAB_H
|
||||
|
||||
#include "libavutil/mem.h"
|
||||
#include "aac.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* NOTE:
|
||||
* Tables in this file are used by the AAC decoder and will be used by the AAC
|
||||
* encoder.
|
||||
*/
|
||||
|
||||
/* @name window coefficients
|
||||
* @{
|
||||
*/
|
||||
DECLARE_ALIGNED(16, extern float, ff_aac_kbd_long_1024[1024]);
|
||||
DECLARE_ALIGNED(16, extern float, ff_aac_kbd_short_128[128]);
|
||||
// @}
|
||||
|
||||
/* @name number of scalefactor window bands for long and short transform windows respectively
|
||||
* @{
|
||||
*/
|
||||
extern const uint8_t ff_aac_num_swb_1024[];
|
||||
extern const uint8_t ff_aac_num_swb_128 [];
|
||||
// @}
|
||||
|
||||
extern const uint8_t ff_aac_pred_sfb_max [];
|
||||
|
||||
extern const uint32_t ff_aac_scalefactor_code[121];
|
||||
extern const uint8_t ff_aac_scalefactor_bits[121];
|
||||
|
||||
extern const uint16_t * const ff_aac_spectral_codes[11];
|
||||
extern const uint8_t * const ff_aac_spectral_bits [11];
|
||||
extern const uint16_t ff_aac_spectral_sizes[11];
|
||||
|
||||
extern const float *ff_aac_codebook_vectors[];
|
||||
|
||||
#if CONFIG_HARDCODED_TABLES
|
||||
extern const float ff_aac_pow2sf_tab[428];
|
||||
#else
|
||||
extern float ff_aac_pow2sf_tab[428];
|
||||
#endif /* CONFIG_HARDCODED_TABLES */
|
||||
|
||||
#endif /* AVCODEC_AACTAB_H */
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/aandcttab.c
|
||||
* AAN (Arai Agui Aakajima) (I)DCT tables
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
const uint16_t ff_aanscales[64] = {
|
||||
/* precomputed values scaled up by 14 bits */
|
||||
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
|
||||
22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270,
|
||||
21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906,
|
||||
19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315,
|
||||
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
|
||||
12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552,
|
||||
8867 , 12299, 11585, 10426, 8867, 6967, 4799, 2446,
|
||||
4520 , 6270, 5906, 5315, 4520, 3552, 2446, 1247
|
||||
};
|
||||
|
||||
const uint16_t ff_inv_aanscales[64] = {
|
||||
4096, 2953, 3135, 3483, 4096, 5213, 7568, 14846,
|
||||
2953, 2129, 2260, 2511, 2953, 3759, 5457, 10703,
|
||||
3135, 2260, 2399, 2666, 3135, 3990, 5793, 11363,
|
||||
3483, 2511, 2666, 2962, 3483, 4433, 6436, 12625,
|
||||
4096, 2953, 3135, 3483, 4096, 5213, 7568, 14846,
|
||||
5213, 3759, 3990, 4433, 5213, 6635, 9633, 18895,
|
||||
7568, 5457, 5793, 6436, 7568, 9633, 13985, 27432,
|
||||
14846, 10703, 11363, 12625, 14846, 18895, 27432, 53809,
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/aandcttab.h
|
||||
* AAN (Arai Agui Nakajima) (I)DCT tables
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AANDCTTAB_H
|
||||
#define AVCODEC_AANDCTTAB_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern const uint16_t ff_aanscales[64];
|
||||
extern const uint16_t ff_inv_aanscales[64];
|
||||
|
||||
#endif /* AVCODEC_AANDCTTAB_H */
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Autodesk RLE Decoder
|
||||
* Copyright (C) 2005 the ffmpeg project
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/aasc.c
|
||||
* Autodesk RLE Video Decoder by Konstantin Shishkov
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
#include "msrledec.h"
|
||||
|
||||
typedef struct AascContext {
|
||||
AVCodecContext *avctx;
|
||||
AVFrame frame;
|
||||
} AascContext;
|
||||
|
||||
#define FETCH_NEXT_STREAM_BYTE() \
|
||||
if (stream_ptr >= buf_size) \
|
||||
{ \
|
||||
av_log(s->avctx, AV_LOG_ERROR, " AASC: stream ptr just went out of bounds (fetch)\n"); \
|
||||
break; \
|
||||
} \
|
||||
stream_byte = buf[stream_ptr++];
|
||||
|
||||
static av_cold int aasc_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
AascContext *s = avctx->priv_data;
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
avctx->pix_fmt = PIX_FMT_BGR24;
|
||||
s->frame.data[0] = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aasc_decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *data_size,
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
AascContext *s = avctx->priv_data;
|
||||
int compr, i, stride;
|
||||
|
||||
s->frame.reference = 1;
|
||||
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
|
||||
if (avctx->reget_buffer(avctx, &s->frame)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
compr = AV_RL32(buf);
|
||||
buf += 4;
|
||||
buf_size -= 4;
|
||||
switch(compr){
|
||||
case 0:
|
||||
stride = (avctx->width * 3 + 3) & ~3;
|
||||
for(i = avctx->height - 1; i >= 0; i--){
|
||||
memcpy(s->frame.data[0] + i*s->frame.linesize[0], buf, avctx->width*3);
|
||||
buf += stride;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, buf - 4, buf_size + 4);
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*data_size = sizeof(AVFrame);
|
||||
*(AVFrame*)data = s->frame;
|
||||
|
||||
/* report that the buffer was completely consumed */
|
||||
return buf_size;
|
||||
}
|
||||
|
||||
static av_cold int aasc_decode_end(AVCodecContext *avctx)
|
||||
{
|
||||
AascContext *s = avctx->priv_data;
|
||||
|
||||
/* release the last frame */
|
||||
if (s->frame.data[0])
|
||||
avctx->release_buffer(avctx, &s->frame);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVCodec aasc_decoder = {
|
||||
"aasc",
|
||||
CODEC_TYPE_VIDEO,
|
||||
CODEC_ID_AASC,
|
||||
sizeof(AascContext),
|
||||
aasc_decode_init,
|
||||
NULL,
|
||||
aasc_decode_end,
|
||||
aasc_decode_frame,
|
||||
CODEC_CAP_DR1,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Autodesk RLE"),
|
||||
};
|
||||
@@ -1,246 +0,0 @@
|
||||
/*
|
||||
* Common code between the AC-3 encoder and decoder
|
||||
* Copyright (c) 2000 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/ac3.c
|
||||
* Common code between the AC-3 encoder and decoder.
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "ac3.h"
|
||||
#include "bitstream.h"
|
||||
|
||||
static uint8_t band_start_tab[51];
|
||||
static uint8_t bin_to_band_tab[253];
|
||||
|
||||
static inline int calc_lowcomp1(int a, int b0, int b1, int c)
|
||||
{
|
||||
if ((b0 + 256) == b1) {
|
||||
a = c;
|
||||
} else if (b0 > b1) {
|
||||
a = FFMAX(a - 64, 0);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
static inline int calc_lowcomp(int a, int b0, int b1, int bin)
|
||||
{
|
||||
if (bin < 7) {
|
||||
return calc_lowcomp1(a, b0, b1, 384);
|
||||
} else if (bin < 20) {
|
||||
return calc_lowcomp1(a, b0, b1, 320);
|
||||
} else {
|
||||
return FFMAX(a - 128, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
|
||||
int16_t *band_psd)
|
||||
{
|
||||
int bin, i, j, k, end1, v;
|
||||
|
||||
/* exponent mapping to PSD */
|
||||
for(bin=start;bin<end;bin++) {
|
||||
psd[bin]=(3072 - (exp[bin] << 7));
|
||||
}
|
||||
|
||||
/* PSD integration */
|
||||
j=start;
|
||||
k=bin_to_band_tab[start];
|
||||
do {
|
||||
v=psd[j];
|
||||
j++;
|
||||
end1 = FFMIN(band_start_tab[k+1], end);
|
||||
for(i=j;i<end1;i++) {
|
||||
/* logadd */
|
||||
int adr = FFMIN(FFABS(v - psd[j]) >> 1, 255);
|
||||
v = FFMAX(v, psd[j]) + ff_ac3_log_add_tab[adr];
|
||||
j++;
|
||||
}
|
||||
band_psd[k]=v;
|
||||
k++;
|
||||
} while (end > band_start_tab[k]);
|
||||
}
|
||||
|
||||
int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
|
||||
int start, int end, int fast_gain, int is_lfe,
|
||||
int dba_mode, int dba_nsegs, uint8_t *dba_offsets,
|
||||
uint8_t *dba_lengths, uint8_t *dba_values,
|
||||
int16_t *mask)
|
||||
{
|
||||
int16_t excite[50]; /* excitation */
|
||||
int bin, k;
|
||||
int bndstrt, bndend, begin, end1, tmp;
|
||||
int lowcomp, fastleak, slowleak;
|
||||
|
||||
/* excitation function */
|
||||
bndstrt = bin_to_band_tab[start];
|
||||
bndend = bin_to_band_tab[end-1] + 1;
|
||||
|
||||
if (bndstrt == 0) {
|
||||
lowcomp = 0;
|
||||
lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384);
|
||||
excite[0] = band_psd[0] - fast_gain - lowcomp;
|
||||
lowcomp = calc_lowcomp1(lowcomp, band_psd[1], band_psd[2], 384);
|
||||
excite[1] = band_psd[1] - fast_gain - lowcomp;
|
||||
begin = 7;
|
||||
for (bin = 2; bin < 7; bin++) {
|
||||
if (!(is_lfe && bin == 6))
|
||||
lowcomp = calc_lowcomp1(lowcomp, band_psd[bin], band_psd[bin+1], 384);
|
||||
fastleak = band_psd[bin] - fast_gain;
|
||||
slowleak = band_psd[bin] - s->slow_gain;
|
||||
excite[bin] = fastleak - lowcomp;
|
||||
if (!(is_lfe && bin == 6)) {
|
||||
if (band_psd[bin] <= band_psd[bin+1]) {
|
||||
begin = bin + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end1=bndend;
|
||||
if (end1 > 22) end1=22;
|
||||
|
||||
for (bin = begin; bin < end1; bin++) {
|
||||
if (!(is_lfe && bin == 6))
|
||||
lowcomp = calc_lowcomp(lowcomp, band_psd[bin], band_psd[bin+1], bin);
|
||||
|
||||
fastleak = FFMAX(fastleak - s->fast_decay, band_psd[bin] - fast_gain);
|
||||
slowleak = FFMAX(slowleak - s->slow_decay, band_psd[bin] - s->slow_gain);
|
||||
excite[bin] = FFMAX(fastleak - lowcomp, slowleak);
|
||||
}
|
||||
begin = 22;
|
||||
} else {
|
||||
/* coupling channel */
|
||||
begin = bndstrt;
|
||||
|
||||
fastleak = (s->cpl_fast_leak << 8) + 768;
|
||||
slowleak = (s->cpl_slow_leak << 8) + 768;
|
||||
}
|
||||
|
||||
for (bin = begin; bin < bndend; bin++) {
|
||||
fastleak = FFMAX(fastleak - s->fast_decay, band_psd[bin] - fast_gain);
|
||||
slowleak = FFMAX(slowleak - s->slow_decay, band_psd[bin] - s->slow_gain);
|
||||
excite[bin] = FFMAX(fastleak, slowleak);
|
||||
}
|
||||
|
||||
/* compute masking curve */
|
||||
|
||||
for (bin = bndstrt; bin < bndend; bin++) {
|
||||
tmp = s->db_per_bit - band_psd[bin];
|
||||
if (tmp > 0) {
|
||||
excite[bin] += tmp >> 2;
|
||||
}
|
||||
mask[bin] = FFMAX(ff_ac3_hearing_threshold_tab[bin >> s->sr_shift][s->sr_code], excite[bin]);
|
||||
}
|
||||
|
||||
/* delta bit allocation */
|
||||
|
||||
if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) {
|
||||
int band, seg, delta;
|
||||
if (dba_nsegs >= 8)
|
||||
return -1;
|
||||
band = 0;
|
||||
for (seg = 0; seg < dba_nsegs; seg++) {
|
||||
band += dba_offsets[seg];
|
||||
if (band >= 50 || dba_lengths[seg] > 50-band)
|
||||
return -1;
|
||||
if (dba_values[seg] >= 4) {
|
||||
delta = (dba_values[seg] - 3) << 7;
|
||||
} else {
|
||||
delta = (dba_values[seg] - 4) << 7;
|
||||
}
|
||||
for (k = 0; k < dba_lengths[seg]; k++) {
|
||||
mask[band] += delta;
|
||||
band++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
|
||||
int snr_offset, int floor,
|
||||
const uint8_t *bap_tab, uint8_t *bap)
|
||||
{
|
||||
int i, j, k, end1, v, address;
|
||||
|
||||
/* special case, if snr offset is -960, set all bap's to zero */
|
||||
if(snr_offset == -960) {
|
||||
memset(bap, 0, 256);
|
||||
return;
|
||||
}
|
||||
|
||||
i = start;
|
||||
j = bin_to_band_tab[start];
|
||||
do {
|
||||
v = (FFMAX(mask[j] - snr_offset - floor, 0) & 0x1FE0) + floor;
|
||||
end1 = FFMIN(band_start_tab[j] + ff_ac3_critical_band_size_tab[j], end);
|
||||
for (k = i; k < end1; k++) {
|
||||
address = av_clip((psd[i] - v) >> 5, 0, 63);
|
||||
bap[i] = bap_tab[address];
|
||||
i++;
|
||||
}
|
||||
} while (end > band_start_tab[j++]);
|
||||
}
|
||||
|
||||
/* AC-3 bit allocation. The algorithm is the one described in the AC-3
|
||||
spec. */
|
||||
void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
|
||||
int8_t *exp, int start, int end,
|
||||
int snr_offset, int fast_gain, int is_lfe,
|
||||
int dba_mode, int dba_nsegs,
|
||||
uint8_t *dba_offsets, uint8_t *dba_lengths,
|
||||
uint8_t *dba_values)
|
||||
{
|
||||
int16_t psd[256]; /* scaled exponents */
|
||||
int16_t band_psd[50]; /* interpolated exponents */
|
||||
int16_t mask[50]; /* masking value */
|
||||
|
||||
ff_ac3_bit_alloc_calc_psd(exp, start, end, psd, band_psd);
|
||||
|
||||
ff_ac3_bit_alloc_calc_mask(s, band_psd, start, end, fast_gain, is_lfe,
|
||||
dba_mode, dba_nsegs, dba_offsets, dba_lengths, dba_values,
|
||||
mask);
|
||||
|
||||
ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snr_offset, s->floor,
|
||||
ff_ac3_bap_tab, bap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes some tables.
|
||||
* note: This function must remain thread safe because it is called by the
|
||||
* AVParser init code.
|
||||
*/
|
||||
av_cold void ac3_common_init(void)
|
||||
{
|
||||
int i, j, k, l, v;
|
||||
/* compute bndtab and masktab from bandsz */
|
||||
k = 0;
|
||||
l = 0;
|
||||
for(i=0;i<50;i++) {
|
||||
band_start_tab[i] = l;
|
||||
v = ff_ac3_critical_band_size_tab[i];
|
||||
for(j=0;j<v;j++) bin_to_band_tab[k++]=i;
|
||||
l += v;
|
||||
}
|
||||
band_start_tab[50] = l;
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* Common code between the AC-3 encoder and decoder
|
||||
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/ac3.h
|
||||
* Common code between the AC-3 encoder and decoder.
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AC3_H
|
||||
#define AVCODEC_AC3_H
|
||||
|
||||
#include "ac3tab.h"
|
||||
|
||||
#define AC3_MAX_CODED_FRAME_SIZE 3840 /* in bytes */
|
||||
#define AC3_MAX_CHANNELS 6 /* including LFE channel */
|
||||
|
||||
#define NB_BLOCKS 6 /* number of PCM blocks inside an AC-3 frame */
|
||||
#define AC3_FRAME_SIZE (NB_BLOCKS * 256)
|
||||
|
||||
/* exponent encoding strategy */
|
||||
#define EXP_REUSE 0
|
||||
#define EXP_NEW 1
|
||||
|
||||
#define EXP_D15 1
|
||||
#define EXP_D25 2
|
||||
#define EXP_D45 3
|
||||
|
||||
/** Delta bit allocation strategy */
|
||||
typedef enum {
|
||||
DBA_REUSE = 0,
|
||||
DBA_NEW,
|
||||
DBA_NONE,
|
||||
DBA_RESERVED
|
||||
} AC3DeltaStrategy;
|
||||
|
||||
/** Channel mode (audio coding mode) */
|
||||
typedef enum {
|
||||
AC3_CHMODE_DUALMONO = 0,
|
||||
AC3_CHMODE_MONO,
|
||||
AC3_CHMODE_STEREO,
|
||||
AC3_CHMODE_3F,
|
||||
AC3_CHMODE_2F1R,
|
||||
AC3_CHMODE_3F1R,
|
||||
AC3_CHMODE_2F2R,
|
||||
AC3_CHMODE_3F2R
|
||||
} AC3ChannelMode;
|
||||
|
||||
typedef struct AC3BitAllocParameters {
|
||||
int sr_code;
|
||||
int sr_shift;
|
||||
int slow_gain, slow_decay, fast_decay, db_per_bit, floor;
|
||||
int cpl_fast_leak, cpl_slow_leak;
|
||||
} AC3BitAllocParameters;
|
||||
|
||||
/**
|
||||
* @struct AC3HeaderInfo
|
||||
* Coded AC-3 header values up to the lfeon element, plus derived values.
|
||||
*/
|
||||
typedef struct {
|
||||
/** @defgroup coded Coded elements
|
||||
* @{
|
||||
*/
|
||||
uint16_t sync_word;
|
||||
uint16_t crc1;
|
||||
uint8_t sr_code;
|
||||
uint8_t bitstream_id;
|
||||
uint8_t channel_mode;
|
||||
uint8_t lfe_on;
|
||||
uint8_t frame_type;
|
||||
int substreamid; ///< substream identification
|
||||
int center_mix_level; ///< Center mix level index
|
||||
int surround_mix_level; ///< Surround mix level index
|
||||
uint16_t channel_map;
|
||||
int num_blocks; ///< number of audio blocks
|
||||
/** @} */
|
||||
|
||||
/** @defgroup derived Derived values
|
||||
* @{
|
||||
*/
|
||||
uint8_t sr_shift;
|
||||
uint16_t sample_rate;
|
||||
uint32_t bit_rate;
|
||||
uint8_t channels;
|
||||
uint16_t frame_size;
|
||||
/** @} */
|
||||
} AC3HeaderInfo;
|
||||
|
||||
typedef enum {
|
||||
EAC3_FRAME_TYPE_INDEPENDENT = 0,
|
||||
EAC3_FRAME_TYPE_DEPENDENT,
|
||||
EAC3_FRAME_TYPE_AC3_CONVERT,
|
||||
EAC3_FRAME_TYPE_RESERVED
|
||||
} EAC3FrameType;
|
||||
|
||||
void ac3_common_init(void);
|
||||
|
||||
/**
|
||||
* Calculates the log power-spectral density of the input signal.
|
||||
* This gives a rough estimate of signal power in the frequency domain by using
|
||||
* the spectral envelope (exponents). The psd is also separately grouped
|
||||
* into critical bands for use in the calculating the masking curve.
|
||||
* 128 units in psd = -6 dB. The dbknee parameter in AC3BitAllocParameters
|
||||
* determines the reference level.
|
||||
*
|
||||
* @param[in] exp frequency coefficient exponents
|
||||
* @param[in] start starting bin location
|
||||
* @param[in] end ending bin location
|
||||
* @param[out] psd signal power for each frequency bin
|
||||
* @param[out] band_psd signal power for each critical band
|
||||
*/
|
||||
void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
|
||||
int16_t *band_psd);
|
||||
|
||||
/**
|
||||
* Calculates the masking curve.
|
||||
* First, the excitation is calculated using parameters in \p s and the signal
|
||||
* power in each critical band. The excitation is compared with a predefined
|
||||
* hearing threshold table to produce the masking curve. If delta bit
|
||||
* allocation information is provided, it is used for adjusting the masking
|
||||
* curve, usually to give a closer match to a better psychoacoustic model.
|
||||
*
|
||||
* @param[in] s adjustable bit allocation parameters
|
||||
* @param[in] band_psd signal power for each critical band
|
||||
* @param[in] start starting bin location
|
||||
* @param[in] end ending bin location
|
||||
* @param[in] fast_gain fast gain (estimated signal-to-mask ratio)
|
||||
* @param[in] is_lfe whether or not the channel being processed is the LFE
|
||||
* @param[in] dba_mode delta bit allocation mode (none, reuse, or new)
|
||||
* @param[in] dba_nsegs number of delta segments
|
||||
* @param[in] dba_offsets location offsets for each segment
|
||||
* @param[in] dba_lengths length of each segment
|
||||
* @param[in] dba_values delta bit allocation for each segment
|
||||
* @param[out] mask calculated masking curve
|
||||
* @return returns 0 for success, non-zero for error
|
||||
*/
|
||||
int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
|
||||
int start, int end, int fast_gain, int is_lfe,
|
||||
int dba_mode, int dba_nsegs, uint8_t *dba_offsets,
|
||||
uint8_t *dba_lengths, uint8_t *dba_values,
|
||||
int16_t *mask);
|
||||
|
||||
/**
|
||||
* Calculates bit allocation pointers.
|
||||
* The SNR is the difference between the masking curve and the signal. AC-3
|
||||
* uses this value for each frequency bin to allocate bits. The \p snroffset
|
||||
* parameter is a global adjustment to the SNR for all bins.
|
||||
*
|
||||
* @param[in] mask masking curve
|
||||
* @param[in] psd signal power for each frequency bin
|
||||
* @param[in] start starting bin location
|
||||
* @param[in] end ending bin location
|
||||
* @param[in] snr_offset SNR adjustment
|
||||
* @param[in] floor noise floor
|
||||
* @param[in] bap_tab look-up table for bit allocation pointers
|
||||
* @param[out] bap bit allocation pointers
|
||||
*/
|
||||
void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
|
||||
int snr_offset, int floor,
|
||||
const uint8_t *bap_tab, uint8_t *bap);
|
||||
|
||||
void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
|
||||
int8_t *exp, int start, int end,
|
||||
int snr_offset, int fast_gain, int is_lfe,
|
||||
int dba_mode, int dba_nsegs,
|
||||
uint8_t *dba_offsets, uint8_t *dba_lengths,
|
||||
uint8_t *dba_values);
|
||||
|
||||
#endif /* AVCODEC_AC3_H */
|
||||
@@ -1,203 +0,0 @@
|
||||
/*
|
||||
* AC-3 parser
|
||||
* Copyright (c) 2003 Fabrice Bellard
|
||||
* Copyright (c) 2003 Michael Niedermayer
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "parser.h"
|
||||
#include "ac3_parser.h"
|
||||
#include "aac_ac3_parser.h"
|
||||
#include "bitstream.h"
|
||||
|
||||
|
||||
#define AC3_HEADER_SIZE 7
|
||||
|
||||
|
||||
static const uint8_t eac3_blocks[4] = {
|
||||
1, 2, 3, 6
|
||||
};
|
||||
|
||||
|
||||
int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
|
||||
{
|
||||
int frame_size_code;
|
||||
|
||||
memset(hdr, 0, sizeof(*hdr));
|
||||
|
||||
hdr->sync_word = get_bits(gbc, 16);
|
||||
if(hdr->sync_word != 0x0B77)
|
||||
return AAC_AC3_PARSE_ERROR_SYNC;
|
||||
|
||||
/* read ahead to bsid to distinguish between AC-3 and E-AC-3 */
|
||||
hdr->bitstream_id = show_bits_long(gbc, 29) & 0x1F;
|
||||
if(hdr->bitstream_id > 16)
|
||||
return AAC_AC3_PARSE_ERROR_BSID;
|
||||
|
||||
hdr->num_blocks = 6;
|
||||
|
||||
/* set default mix levels */
|
||||
hdr->center_mix_level = 1; // -4.5dB
|
||||
hdr->surround_mix_level = 1; // -6.0dB
|
||||
|
||||
if(hdr->bitstream_id <= 10) {
|
||||
/* Normal AC-3 */
|
||||
hdr->crc1 = get_bits(gbc, 16);
|
||||
hdr->sr_code = get_bits(gbc, 2);
|
||||
if(hdr->sr_code == 3)
|
||||
return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
|
||||
|
||||
frame_size_code = get_bits(gbc, 6);
|
||||
if(frame_size_code > 37)
|
||||
return AAC_AC3_PARSE_ERROR_FRAME_SIZE;
|
||||
|
||||
skip_bits(gbc, 5); // skip bsid, already got it
|
||||
|
||||
skip_bits(gbc, 3); // skip bitstream mode
|
||||
hdr->channel_mode = get_bits(gbc, 3);
|
||||
|
||||
if(hdr->channel_mode == AC3_CHMODE_STEREO) {
|
||||
skip_bits(gbc, 2); // skip dsurmod
|
||||
} else {
|
||||
if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO)
|
||||
hdr->center_mix_level = get_bits(gbc, 2);
|
||||
if(hdr->channel_mode & 4)
|
||||
hdr->surround_mix_level = get_bits(gbc, 2);
|
||||
}
|
||||
hdr->lfe_on = get_bits1(gbc);
|
||||
|
||||
hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8;
|
||||
hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift;
|
||||
hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift;
|
||||
hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
|
||||
hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2;
|
||||
hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; //EAC3_FRAME_TYPE_INDEPENDENT;
|
||||
hdr->substreamid = 0;
|
||||
} else {
|
||||
/* Enhanced AC-3 */
|
||||
hdr->crc1 = 0;
|
||||
hdr->frame_type = get_bits(gbc, 2);
|
||||
if(hdr->frame_type == EAC3_FRAME_TYPE_RESERVED)
|
||||
return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
|
||||
|
||||
hdr->substreamid = get_bits(gbc, 3);
|
||||
|
||||
hdr->frame_size = (get_bits(gbc, 11) + 1) << 1;
|
||||
if(hdr->frame_size < AC3_HEADER_SIZE)
|
||||
return AAC_AC3_PARSE_ERROR_FRAME_SIZE;
|
||||
|
||||
hdr->sr_code = get_bits(gbc, 2);
|
||||
if (hdr->sr_code == 3) {
|
||||
int sr_code2 = get_bits(gbc, 2);
|
||||
if(sr_code2 == 3)
|
||||
return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
|
||||
hdr->sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2;
|
||||
hdr->sr_shift = 1;
|
||||
} else {
|
||||
hdr->num_blocks = eac3_blocks[get_bits(gbc, 2)];
|
||||
hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code];
|
||||
hdr->sr_shift = 0;
|
||||
}
|
||||
|
||||
hdr->channel_mode = get_bits(gbc, 3);
|
||||
hdr->lfe_on = get_bits1(gbc);
|
||||
|
||||
hdr->bit_rate = (uint32_t)(8.0 * hdr->frame_size * hdr->sample_rate /
|
||||
(hdr->num_blocks * 256.0));
|
||||
hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr){
|
||||
int ret, i;
|
||||
ret = ff_ac3_parse_header(gbc, hdr);
|
||||
if(!ret){
|
||||
if(hdr->bitstream_id>10){
|
||||
/* Enhanced AC-3 */
|
||||
skip_bits(gbc, 5); // skip bitstream id
|
||||
|
||||
/* skip dialog normalization and compression gain */
|
||||
for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) {
|
||||
skip_bits(gbc, 5); // skip dialog normalization
|
||||
if (get_bits1(gbc)) {
|
||||
skip_bits(gbc, 8); //skip Compression gain word
|
||||
}
|
||||
}
|
||||
/* dependent stream channel map */
|
||||
if (hdr->frame_type == EAC3_FRAME_TYPE_DEPENDENT && get_bits1(gbc)) {
|
||||
hdr->channel_map = get_bits(gbc, 16); //custom channel map
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//default channel map based on acmod and lfeon
|
||||
hdr->channel_map = ff_eac3_default_chmap[hdr->channel_mode];
|
||||
if(hdr->lfe_on)
|
||||
hdr->channel_map |= AC3_CHMAP_LFE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
|
||||
int *need_next_header, int *new_frame_start)
|
||||
{
|
||||
int err;
|
||||
union {
|
||||
uint64_t u64;
|
||||
uint8_t u8[8];
|
||||
} tmp = { be2me_64(state) };
|
||||
AC3HeaderInfo hdr;
|
||||
GetBitContext gbc;
|
||||
|
||||
init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);
|
||||
err = ff_ac3_parse_header(&gbc, &hdr);
|
||||
|
||||
if(err < 0)
|
||||
return 0;
|
||||
|
||||
hdr_info->sample_rate = hdr.sample_rate;
|
||||
hdr_info->bit_rate = hdr.bit_rate;
|
||||
hdr_info->channels = hdr.channels;
|
||||
hdr_info->samples = hdr.num_blocks * 256;
|
||||
if(hdr.bitstream_id>10)
|
||||
hdr_info->codec_id = CODEC_ID_EAC3;
|
||||
else
|
||||
hdr_info->codec_id = CODEC_ID_AC3;
|
||||
|
||||
*need_next_header = (hdr.frame_type != EAC3_FRAME_TYPE_AC3_CONVERT);
|
||||
*new_frame_start = (hdr.frame_type != EAC3_FRAME_TYPE_DEPENDENT);
|
||||
return hdr.frame_size;
|
||||
}
|
||||
|
||||
static av_cold int ac3_parse_init(AVCodecParserContext *s1)
|
||||
{
|
||||
AACAC3ParseContext *s = s1->priv_data;
|
||||
s->header_size = AC3_HEADER_SIZE;
|
||||
s->sync = ac3_sync;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
AVCodecParser ac3_parser = {
|
||||
{ CODEC_ID_AC3, CODEC_ID_EAC3 },
|
||||
sizeof(AACAC3ParseContext),
|
||||
ac3_parse_init,
|
||||
ff_aac_ac3_parse,
|
||||
ff_parse_close,
|
||||
};
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* AC-3 parser prototypes
|
||||
* Copyright (c) 2003 Fabrice Bellard
|
||||
* Copyright (c) 2003 Michael Niedermayer
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AC3_PARSER_H
|
||||
#define AVCODEC_AC3_PARSER_H
|
||||
|
||||
#include "ac3.h"
|
||||
#include "bitstream.h"
|
||||
|
||||
/**
|
||||
* Parses AC-3 frame header.
|
||||
* Parses the header up to the lfeon element, which is the first 52 or 54 bits
|
||||
* depending on the audio coding mode.
|
||||
* @param gbc[in] BitContext containing the first 54 bits of the frame.
|
||||
* @param hdr[out] Pointer to struct where header info is written.
|
||||
* @return Returns 0 on success, -1 if there is a sync word mismatch,
|
||||
* -2 if the bsid (version) element is invalid, -3 if the fscod (sample rate)
|
||||
* element is invalid, or -4 if the frmsizecod (bit rate) element is invalid.
|
||||
*/
|
||||
int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr);
|
||||
|
||||
/**
|
||||
* Parses AC-3 frame header and sets channel_map
|
||||
* Parses the header up to the lfeon (channel_map in E-AC-3)
|
||||
* element, which is the first 52, 54 or 104 bits depending
|
||||
* on the audio coding mode.
|
||||
* @param gbc[in] BitContext containing the first 54 bits of the frame.
|
||||
* @param hdr[out] Pointer to struct where header info is written.
|
||||
* @return value returned by ff_ac3_parse_header
|
||||
*/
|
||||
int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr);
|
||||
|
||||
#endif /* AVCODEC_AC3_PARSER_H */
|
||||
-1365
File diff suppressed because it is too large
Load Diff
@@ -1,183 +0,0 @@
|
||||
/*
|
||||
* Common code between the AC-3 and E-AC-3 decoders
|
||||
* Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec@gmail.com>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/ac3.h
|
||||
* Common code between the AC-3 and E-AC-3 decoders.
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AC3DEC_H
|
||||
#define AVCODEC_AC3DEC_H
|
||||
|
||||
#include "libavutil/internal.h"
|
||||
#include "libavutil/lfg.h"
|
||||
#include "ac3.h"
|
||||
#include "bitstream.h"
|
||||
#include "dsputil.h"
|
||||
|
||||
/* override ac3.h to include coupling channel */
|
||||
#undef AC3_MAX_CHANNELS
|
||||
#define AC3_MAX_CHANNELS 7
|
||||
#define CPL_CH 0
|
||||
|
||||
#define AC3_OUTPUT_LFEON 8
|
||||
|
||||
#define AC3_MAX_COEFS 256
|
||||
#define AC3_BLOCK_SIZE 256
|
||||
#define MAX_BLOCKS 6
|
||||
|
||||
typedef struct {
|
||||
AVCodecContext *avctx; ///< parent context
|
||||
GetBitContext gbc; ///< bitstream reader
|
||||
uint8_t *input_buffer; ///< temp buffer to prevent overread
|
||||
|
||||
///@defgroup bsi bit stream information
|
||||
///@{
|
||||
int frame_type; ///< frame type (strmtyp)
|
||||
int substreamid; ///< substream identification
|
||||
int frame_size; ///< current frame size, in bytes
|
||||
int bit_rate; ///< stream bit rate, in bits-per-second
|
||||
int sample_rate; ///< sample frequency, in Hz
|
||||
int num_blocks; ///< number of audio blocks
|
||||
int channel_mode; ///< channel mode (acmod)
|
||||
int lfe_on; ///< lfe channel in use
|
||||
int channel_map; ///< custom channel map
|
||||
int center_mix_level; ///< Center mix level index
|
||||
int surround_mix_level; ///< Surround mix level index
|
||||
int eac3; ///< indicates if current frame is E-AC-3
|
||||
///@}
|
||||
|
||||
///@defgroup audfrm frame syntax parameters
|
||||
int snr_offset_strategy; ///< SNR offset strategy (snroffststr)
|
||||
int block_switch_syntax; ///< block switch syntax enabled (blkswe)
|
||||
int dither_flag_syntax; ///< dither flag syntax enabled (dithflage)
|
||||
int bit_allocation_syntax; ///< bit allocation model syntax enabled (bamode)
|
||||
int fast_gain_syntax; ///< fast gain codes enabled (frmfgaincode)
|
||||
int dba_syntax; ///< delta bit allocation syntax enabled (dbaflde)
|
||||
int skip_syntax; ///< skip field syntax enabled (skipflde)
|
||||
///@}
|
||||
|
||||
///@defgroup cpl standard coupling
|
||||
int cpl_in_use[MAX_BLOCKS]; ///< coupling in use (cplinu)
|
||||
int cpl_strategy_exists[MAX_BLOCKS]; ///< coupling strategy exists (cplstre)
|
||||
int channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling (chincpl)
|
||||
int phase_flags_in_use; ///< phase flags in use (phsflginu)
|
||||
int phase_flags[18]; ///< phase flags (phsflg)
|
||||
int num_cpl_subbands; ///< number of coupling sub bands (ncplsubnd)
|
||||
int num_cpl_bands; ///< number of coupling bands (ncplbnd)
|
||||
uint8_t cpl_band_struct[18]; ///< coupling band structure (cplbndstrc)
|
||||
int firstchincpl; ///< first channel in coupling
|
||||
int first_cpl_coords[AC3_MAX_CHANNELS]; ///< first coupling coordinates states (firstcplcos)
|
||||
int cpl_coords[AC3_MAX_CHANNELS][18]; ///< coupling coordinates (cplco)
|
||||
///@}
|
||||
|
||||
///@defgroup aht adaptive hybrid transform
|
||||
int channel_uses_aht[AC3_MAX_CHANNELS]; ///< channel AHT in use (chahtinu)
|
||||
int pre_mantissa[AC3_MAX_CHANNELS][AC3_MAX_COEFS][MAX_BLOCKS]; ///< pre-IDCT mantissas
|
||||
///@}
|
||||
|
||||
///@defgroup channel channel
|
||||
int fbw_channels; ///< number of full-bandwidth channels
|
||||
int channels; ///< number of total channels
|
||||
int lfe_ch; ///< index of LFE channel
|
||||
float downmix_coeffs[AC3_MAX_CHANNELS][2]; ///< stereo downmix coefficients
|
||||
int downmixed; ///< indicates if coeffs are currently downmixed
|
||||
int output_mode; ///< output channel configuration
|
||||
int out_channels; ///< number of output channels
|
||||
///@}
|
||||
|
||||
///@defgroup dynrng dynamic range
|
||||
float dynamic_range[2]; ///< dynamic range
|
||||
///@}
|
||||
|
||||
///@defgroup bandwidth bandwidth
|
||||
int start_freq[AC3_MAX_CHANNELS]; ///< start frequency bin (strtmant)
|
||||
int end_freq[AC3_MAX_CHANNELS]; ///< end frequency bin (endmant)
|
||||
///@}
|
||||
|
||||
///@defgroup rematrixing rematrixing
|
||||
int num_rematrixing_bands; ///< number of rematrixing bands (nrematbnd)
|
||||
int rematrixing_flags[4]; ///< rematrixing flags (rematflg)
|
||||
///@}
|
||||
|
||||
///@defgroup exponents exponents
|
||||
int num_exp_groups[AC3_MAX_CHANNELS]; ///< Number of exponent groups (nexpgrp)
|
||||
int8_t dexps[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< decoded exponents
|
||||
int exp_strategy[MAX_BLOCKS][AC3_MAX_CHANNELS]; ///< exponent strategies (expstr)
|
||||
///@}
|
||||
|
||||
///@defgroup bitalloc bit allocation
|
||||
AC3BitAllocParameters bit_alloc_params; ///< bit allocation parameters
|
||||
int first_cpl_leak; ///< first coupling leak state (firstcplleak)
|
||||
int snr_offset[AC3_MAX_CHANNELS]; ///< signal-to-noise ratio offsets (snroffst)
|
||||
int fast_gain[AC3_MAX_CHANNELS]; ///< fast gain values/SMR's (fgain)
|
||||
uint8_t bap[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< bit allocation pointers
|
||||
int16_t psd[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< scaled exponents
|
||||
int16_t band_psd[AC3_MAX_CHANNELS][50]; ///< interpolated exponents
|
||||
int16_t mask[AC3_MAX_CHANNELS][50]; ///< masking curve values
|
||||
int dba_mode[AC3_MAX_CHANNELS]; ///< delta bit allocation mode
|
||||
int dba_nsegs[AC3_MAX_CHANNELS]; ///< number of delta segments
|
||||
uint8_t dba_offsets[AC3_MAX_CHANNELS][8]; ///< delta segment offsets
|
||||
uint8_t dba_lengths[AC3_MAX_CHANNELS][8]; ///< delta segment lengths
|
||||
uint8_t dba_values[AC3_MAX_CHANNELS][8]; ///< delta values for each segment
|
||||
///@}
|
||||
|
||||
///@defgroup dithering zero-mantissa dithering
|
||||
int dither_flag[AC3_MAX_CHANNELS]; ///< dither flags (dithflg)
|
||||
AVLFG dith_state; ///< for dither generation
|
||||
///@}
|
||||
|
||||
///@defgroup imdct IMDCT
|
||||
int block_switch[AC3_MAX_CHANNELS]; ///< block switch flags (blksw)
|
||||
MDCTContext imdct_512; ///< for 512 sample IMDCT
|
||||
MDCTContext imdct_256; ///< for 256 sample IMDCT
|
||||
///@}
|
||||
|
||||
///@defgroup opt optimization
|
||||
DSPContext dsp; ///< for optimization
|
||||
float add_bias; ///< offset for float_to_int16 conversion
|
||||
float mul_bias; ///< scaling for float_to_int16 conversion
|
||||
///@}
|
||||
|
||||
DECLARE_ALIGNED_16(int, fixed_coeffs[AC3_MAX_CHANNELS][AC3_MAX_COEFS]); ///> fixed-point transform coefficients
|
||||
|
||||
///@defgroup arrays aligned arrays
|
||||
DECLARE_ALIGNED_16(float, transform_coeffs[AC3_MAX_CHANNELS][AC3_MAX_COEFS]); ///< transform coefficients
|
||||
DECLARE_ALIGNED_16(float, delay[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]); ///< delay - added to the next block
|
||||
DECLARE_ALIGNED_16(float, window[AC3_BLOCK_SIZE]); ///< window coefficients
|
||||
DECLARE_ALIGNED_16(float, tmp_output[AC3_BLOCK_SIZE]); ///< temporary storage for output before windowing
|
||||
DECLARE_ALIGNED_16(float, output[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]); ///< output after imdct transform and windowing
|
||||
///@}
|
||||
} AC3DecodeContext;
|
||||
|
||||
/**
|
||||
* Parse the E-AC-3 frame header.
|
||||
* This parses both the bit stream info and audio frame header.
|
||||
*/
|
||||
int ff_eac3_parse_header(AC3DecodeContext *s);
|
||||
|
||||
/**
|
||||
* Decode mantissas in a single channel for the entire frame.
|
||||
* This is used when AHT mode is enabled.
|
||||
*/
|
||||
void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
|
||||
|
||||
#endif /* AVCODEC_AC3DEC_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* AC-3 and E-AC-3 decoder tables
|
||||
* Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec@gmail.com>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AC3DEC_DATA_H
|
||||
#define AVCODEC_AC3DEC_DATA_H
|
||||
|
||||
#include "libavutil/common.h"
|
||||
|
||||
extern const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3];
|
||||
extern const uint8_t ff_eac3_hebap_tab[64];
|
||||
extern const uint8_t ff_eac3_bits_vs_hebap[20];
|
||||
extern const int16_t ff_eac3_gaq_remap_1[12];
|
||||
extern const int16_t ff_eac3_gaq_remap_2_4_a[9][2];
|
||||
extern const int8_t ff_eac3_gaq_remap_2_4_b[9][2];
|
||||
|
||||
extern const int16_t (* const ff_eac3_mantissa_vq[8])[6];
|
||||
extern const uint8_t ff_eac3_frm_expstr[32][6];
|
||||
extern const uint8_t ff_eac3_default_cpl_band_struct[18];
|
||||
|
||||
extern const uint8_t ff_ac3_rematrix_band_tab[5];
|
||||
|
||||
#endif /* AVCODEC_AC3DEC_DATA_H */
|
||||
-1369
File diff suppressed because it is too large
Load Diff
@@ -1,262 +0,0 @@
|
||||
/*
|
||||
* AC-3 tables
|
||||
* copyright (c) 2001 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/ac3tab.c
|
||||
* tables taken directly from the AC-3 spec.
|
||||
*/
|
||||
|
||||
#include "ac3tab.h"
|
||||
|
||||
/**
|
||||
* Possible frame sizes.
|
||||
* from ATSC A/52 Table 5.18 Frame Size Code Table.
|
||||
*/
|
||||
const uint16_t ff_ac3_frame_size_tab[38][3] = {
|
||||
{ 64, 69, 96 },
|
||||
{ 64, 70, 96 },
|
||||
{ 80, 87, 120 },
|
||||
{ 80, 88, 120 },
|
||||
{ 96, 104, 144 },
|
||||
{ 96, 105, 144 },
|
||||
{ 112, 121, 168 },
|
||||
{ 112, 122, 168 },
|
||||
{ 128, 139, 192 },
|
||||
{ 128, 140, 192 },
|
||||
{ 160, 174, 240 },
|
||||
{ 160, 175, 240 },
|
||||
{ 192, 208, 288 },
|
||||
{ 192, 209, 288 },
|
||||
{ 224, 243, 336 },
|
||||
{ 224, 244, 336 },
|
||||
{ 256, 278, 384 },
|
||||
{ 256, 279, 384 },
|
||||
{ 320, 348, 480 },
|
||||
{ 320, 349, 480 },
|
||||
{ 384, 417, 576 },
|
||||
{ 384, 418, 576 },
|
||||
{ 448, 487, 672 },
|
||||
{ 448, 488, 672 },
|
||||
{ 512, 557, 768 },
|
||||
{ 512, 558, 768 },
|
||||
{ 640, 696, 960 },
|
||||
{ 640, 697, 960 },
|
||||
{ 768, 835, 1152 },
|
||||
{ 768, 836, 1152 },
|
||||
{ 896, 975, 1344 },
|
||||
{ 896, 976, 1344 },
|
||||
{ 1024, 1114, 1536 },
|
||||
{ 1024, 1115, 1536 },
|
||||
{ 1152, 1253, 1728 },
|
||||
{ 1152, 1254, 1728 },
|
||||
{ 1280, 1393, 1920 },
|
||||
{ 1280, 1394, 1920 },
|
||||
};
|
||||
|
||||
/**
|
||||
* Maps audio coding mode (acmod) to number of full-bandwidth channels.
|
||||
* from ATSC A/52 Table 5.8 Audio Coding Mode
|
||||
*/
|
||||
const uint8_t ff_ac3_channels_tab[8] = {
|
||||
2, 1, 2, 3, 3, 4, 4, 5
|
||||
};
|
||||
|
||||
/* possible frequencies */
|
||||
const uint16_t ff_ac3_sample_rate_tab[3] = { 48000, 44100, 32000 };
|
||||
|
||||
/* possible bitrates */
|
||||
const uint16_t ff_ac3_bitrate_tab[19] = {
|
||||
32, 40, 48, 56, 64, 80, 96, 112, 128,
|
||||
160, 192, 224, 256, 320, 384, 448, 512, 576, 640
|
||||
};
|
||||
|
||||
/* AC-3 MDCT window */
|
||||
|
||||
/* MDCT window */
|
||||
const int16_t ff_ac3_window[256] = {
|
||||
4, 7, 12, 16, 21, 28, 34, 42,
|
||||
51, 61, 72, 84, 97, 111, 127, 145,
|
||||
164, 184, 207, 231, 257, 285, 315, 347,
|
||||
382, 419, 458, 500, 544, 591, 641, 694,
|
||||
750, 810, 872, 937, 1007, 1079, 1155, 1235,
|
||||
1318, 1406, 1497, 1593, 1692, 1796, 1903, 2016,
|
||||
2132, 2253, 2379, 2509, 2644, 2783, 2927, 3076,
|
||||
3230, 3389, 3552, 3721, 3894, 4072, 4255, 4444,
|
||||
4637, 4835, 5038, 5246, 5459, 5677, 5899, 6127,
|
||||
6359, 6596, 6837, 7083, 7334, 7589, 7848, 8112,
|
||||
8380, 8652, 8927, 9207, 9491, 9778,10069,10363,
|
||||
10660,10960,11264,11570,11879,12190,12504,12820,
|
||||
13138,13458,13780,14103,14427,14753,15079,15407,
|
||||
15735,16063,16392,16720,17049,17377,17705,18032,
|
||||
18358,18683,19007,19330,19651,19970,20287,20602,
|
||||
20914,21225,21532,21837,22139,22438,22733,23025,
|
||||
23314,23599,23880,24157,24430,24699,24964,25225,
|
||||
25481,25732,25979,26221,26459,26691,26919,27142,
|
||||
27359,27572,27780,27983,28180,28373,28560,28742,
|
||||
28919,29091,29258,29420,29577,29729,29876,30018,
|
||||
30155,30288,30415,30538,30657,30771,30880,30985,
|
||||
31086,31182,31274,31363,31447,31528,31605,31678,
|
||||
31747,31814,31877,31936,31993,32046,32097,32145,
|
||||
32190,32232,32272,32310,32345,32378,32409,32438,
|
||||
32465,32490,32513,32535,32556,32574,32592,32608,
|
||||
32623,32636,32649,32661,32671,32681,32690,32698,
|
||||
32705,32712,32718,32724,32729,32733,32737,32741,
|
||||
32744,32747,32750,32752,32754,32756,32757,32759,
|
||||
32760,32761,32762,32763,32764,32764,32765,32765,
|
||||
32766,32766,32766,32766,32767,32767,32767,32767,
|
||||
32767,32767,32767,32767,32767,32767,32767,32767,
|
||||
32767,32767,32767,32767,32767,32767,32767,32767,
|
||||
};
|
||||
|
||||
const uint8_t ff_ac3_log_add_tab[260]= {
|
||||
0x40,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x39,0x38,0x37,
|
||||
0x36,0x35,0x34,0x34,0x33,0x32,0x31,0x30,0x2f,0x2f,
|
||||
0x2e,0x2d,0x2c,0x2c,0x2b,0x2a,0x29,0x29,0x28,0x27,
|
||||
0x26,0x26,0x25,0x24,0x24,0x23,0x23,0x22,0x21,0x21,
|
||||
0x20,0x20,0x1f,0x1e,0x1e,0x1d,0x1d,0x1c,0x1c,0x1b,
|
||||
0x1b,0x1a,0x1a,0x19,0x19,0x18,0x18,0x17,0x17,0x16,
|
||||
0x16,0x15,0x15,0x15,0x14,0x14,0x13,0x13,0x13,0x12,
|
||||
0x12,0x12,0x11,0x11,0x11,0x10,0x10,0x10,0x0f,0x0f,
|
||||
0x0f,0x0e,0x0e,0x0e,0x0d,0x0d,0x0d,0x0d,0x0c,0x0c,
|
||||
0x0c,0x0c,0x0b,0x0b,0x0b,0x0b,0x0a,0x0a,0x0a,0x0a,
|
||||
0x0a,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x08,
|
||||
0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x06,0x06,
|
||||
0x06,0x06,0x06,0x06,0x06,0x06,0x05,0x05,0x05,0x05,
|
||||
0x05,0x05,0x05,0x05,0x04,0x04,0x04,0x04,0x04,0x04,
|
||||
0x04,0x04,0x04,0x04,0x04,0x03,0x03,0x03,0x03,0x03,
|
||||
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02,
|
||||
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
|
||||
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,
|
||||
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
|
||||
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
|
||||
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
|
||||
const uint16_t ff_ac3_hearing_threshold_tab[50][3]= {
|
||||
{ 0x04d0,0x04f0,0x0580 },
|
||||
{ 0x04d0,0x04f0,0x0580 },
|
||||
{ 0x0440,0x0460,0x04b0 },
|
||||
{ 0x0400,0x0410,0x0450 },
|
||||
{ 0x03e0,0x03e0,0x0420 },
|
||||
{ 0x03c0,0x03d0,0x03f0 },
|
||||
{ 0x03b0,0x03c0,0x03e0 },
|
||||
{ 0x03b0,0x03b0,0x03d0 },
|
||||
{ 0x03a0,0x03b0,0x03c0 },
|
||||
{ 0x03a0,0x03a0,0x03b0 },
|
||||
{ 0x03a0,0x03a0,0x03b0 },
|
||||
{ 0x03a0,0x03a0,0x03b0 },
|
||||
{ 0x03a0,0x03a0,0x03a0 },
|
||||
{ 0x0390,0x03a0,0x03a0 },
|
||||
{ 0x0390,0x0390,0x03a0 },
|
||||
{ 0x0390,0x0390,0x03a0 },
|
||||
{ 0x0380,0x0390,0x03a0 },
|
||||
{ 0x0380,0x0380,0x03a0 },
|
||||
{ 0x0370,0x0380,0x03a0 },
|
||||
{ 0x0370,0x0380,0x03a0 },
|
||||
{ 0x0360,0x0370,0x0390 },
|
||||
{ 0x0360,0x0370,0x0390 },
|
||||
{ 0x0350,0x0360,0x0390 },
|
||||
{ 0x0350,0x0360,0x0390 },
|
||||
{ 0x0340,0x0350,0x0380 },
|
||||
{ 0x0340,0x0350,0x0380 },
|
||||
{ 0x0330,0x0340,0x0380 },
|
||||
{ 0x0320,0x0340,0x0370 },
|
||||
{ 0x0310,0x0320,0x0360 },
|
||||
{ 0x0300,0x0310,0x0350 },
|
||||
{ 0x02f0,0x0300,0x0340 },
|
||||
{ 0x02f0,0x02f0,0x0330 },
|
||||
{ 0x02f0,0x02f0,0x0320 },
|
||||
{ 0x02f0,0x02f0,0x0310 },
|
||||
{ 0x0300,0x02f0,0x0300 },
|
||||
{ 0x0310,0x0300,0x02f0 },
|
||||
{ 0x0340,0x0320,0x02f0 },
|
||||
{ 0x0390,0x0350,0x02f0 },
|
||||
{ 0x03e0,0x0390,0x0300 },
|
||||
{ 0x0420,0x03e0,0x0310 },
|
||||
{ 0x0460,0x0420,0x0330 },
|
||||
{ 0x0490,0x0450,0x0350 },
|
||||
{ 0x04a0,0x04a0,0x03c0 },
|
||||
{ 0x0460,0x0490,0x0410 },
|
||||
{ 0x0440,0x0460,0x0470 },
|
||||
{ 0x0440,0x0440,0x04a0 },
|
||||
{ 0x0520,0x0480,0x0460 },
|
||||
{ 0x0800,0x0630,0x0440 },
|
||||
{ 0x0840,0x0840,0x0450 },
|
||||
{ 0x0840,0x0840,0x04e0 },
|
||||
};
|
||||
|
||||
const uint8_t ff_ac3_bap_tab[64]= {
|
||||
0, 1, 1, 1, 1, 1, 2, 2, 3, 3,
|
||||
3, 4, 4, 5, 5, 6, 6, 6, 6, 7,
|
||||
7, 7, 7, 8, 8, 8, 8, 9, 9, 9,
|
||||
9, 10, 10, 10, 10, 11, 11, 11, 11, 12,
|
||||
12, 12, 12, 13, 13, 13, 13, 14, 14, 14,
|
||||
14, 14, 14, 14, 14, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 15,
|
||||
};
|
||||
|
||||
const uint8_t ff_ac3_slow_decay_tab[4]={
|
||||
0x0f, 0x11, 0x13, 0x15,
|
||||
};
|
||||
|
||||
const uint8_t ff_ac3_fast_decay_tab[4]={
|
||||
0x3f, 0x53, 0x67, 0x7b,
|
||||
};
|
||||
|
||||
const uint16_t ff_ac3_slow_gain_tab[4]= {
|
||||
0x540, 0x4d8, 0x478, 0x410,
|
||||
};
|
||||
|
||||
const uint16_t ff_ac3_db_per_bit_tab[4]= {
|
||||
0x000, 0x700, 0x900, 0xb00,
|
||||
};
|
||||
|
||||
const int16_t ff_ac3_floor_tab[8]= {
|
||||
0x2f0, 0x2b0, 0x270, 0x230, 0x1f0, 0x170, 0x0f0, 0xf800,
|
||||
};
|
||||
|
||||
const uint16_t ff_ac3_fast_gain_tab[8]= {
|
||||
0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x400,
|
||||
};
|
||||
|
||||
const uint8_t ff_ac3_critical_band_size_tab[50]={
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
|
||||
3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24
|
||||
};
|
||||
/**
|
||||
* Default channel map for a dependent substream defined by acmod
|
||||
*/
|
||||
const uint16_t ff_eac3_default_chmap[8] = {
|
||||
AC3_CHMAP_L | AC3_CHMAP_R, // FIXME Ch1+Ch2
|
||||
AC3_CHMAP_C,
|
||||
AC3_CHMAP_L | AC3_CHMAP_R,
|
||||
AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R,
|
||||
AC3_CHMAP_L | AC3_CHMAP_R | AC3_CHMAP_C_SUR,
|
||||
AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R | AC3_CHMAP_C_SUR,
|
||||
AC3_CHMAP_L | AC3_CHMAP_R | AC3_CHMAP_L_SUR | AC3_CHMAP_R_SUR,
|
||||
AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R | AC3_CHMAP_L_SUR | AC3_CHMAP_R_SUR
|
||||
};
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* AC-3 tables
|
||||
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AC3TAB_H
|
||||
#define AVCODEC_AC3TAB_H
|
||||
|
||||
#include "libavutil/common.h"
|
||||
|
||||
extern const uint16_t ff_ac3_frame_size_tab[38][3];
|
||||
extern const uint8_t ff_ac3_channels_tab[8];
|
||||
extern const uint16_t ff_ac3_sample_rate_tab[3];
|
||||
extern const uint16_t ff_ac3_bitrate_tab[19];
|
||||
extern const int16_t ff_ac3_window[256];
|
||||
extern const uint8_t ff_ac3_log_add_tab[260];
|
||||
extern const uint16_t ff_ac3_hearing_threshold_tab[50][3];
|
||||
extern const uint8_t ff_ac3_bap_tab[64];
|
||||
extern const uint8_t ff_ac3_slow_decay_tab[4];
|
||||
extern const uint8_t ff_ac3_fast_decay_tab[4];
|
||||
extern const uint16_t ff_ac3_slow_gain_tab[4];
|
||||
extern const uint16_t ff_ac3_db_per_bit_tab[4];
|
||||
extern const int16_t ff_ac3_floor_tab[8];
|
||||
extern const uint16_t ff_ac3_fast_gain_tab[8];
|
||||
extern const uint8_t ff_ac3_critical_band_size_tab[50];
|
||||
extern const uint16_t ff_eac3_default_chmap[8];
|
||||
|
||||
/** Custom channel map locations bitmask
|
||||
* Other channels described in documentation:
|
||||
* Lc/Rc pair, Lrs/Rrs pair, Ts, Lsd/Rsd pair,
|
||||
* Lw/Rw pair, Lvh/Rvh pair, Cvh, Reserved, LFE2
|
||||
*/
|
||||
enum CustomChannelMapLocation{
|
||||
AC3_CHMAP_L= 1<<(15-0),
|
||||
AC3_CHMAP_C= 1<<(15-1),
|
||||
AC3_CHMAP_R= 1<<(15-2),
|
||||
AC3_CHMAP_L_SUR= 1<<(15-3),
|
||||
AC3_CHMAP_R_SUR = 1<<(15-4),
|
||||
AC3_CHMAP_C_SUR= 1<<(15-7),
|
||||
AC3_CHMAP_LFE = 1<<(15-15)
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_AC3TAB_H */
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* various filters for ACELP-based codecs
|
||||
*
|
||||
* Copyright (c) 2008 Vladimir Voroshilov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "acelp_filters.h"
|
||||
|
||||
const int16_t ff_acelp_interp_filter[61] =
|
||||
{ /* (0.15) */
|
||||
29443, 28346, 25207, 20449, 14701, 8693,
|
||||
3143, -1352, -4402, -5865, -5850, -4673,
|
||||
-2783, -672, 1211, 2536, 3130, 2991,
|
||||
2259, 1170, 0, -1001, -1652, -1868,
|
||||
-1666, -1147, -464, 218, 756, 1060,
|
||||
1099, 904, 550, 135, -245, -514,
|
||||
-634, -602, -451, -231, 0, 191,
|
||||
308, 340, 296, 198, 78, -36,
|
||||
-120, -163, -165, -132, -79, -19,
|
||||
34, 73, 91, 89, 70, 38,
|
||||
0,
|
||||
};
|
||||
|
||||
void ff_acelp_interpolate(
|
||||
int16_t* out,
|
||||
const int16_t* in,
|
||||
const int16_t* filter_coeffs,
|
||||
int precision,
|
||||
int frac_pos,
|
||||
int filter_length,
|
||||
int length)
|
||||
{
|
||||
int n, i;
|
||||
|
||||
assert(pitch_delay_frac >= 0 && pitch_delay_frac < precision);
|
||||
|
||||
for(n=0; n<length; n++)
|
||||
{
|
||||
int idx = 0;
|
||||
int v = 0x4000;
|
||||
|
||||
for(i=0; i<filter_length;)
|
||||
{
|
||||
|
||||
/* The reference G.729 and AMR fixed point code performs clipping after
|
||||
each of the two following accumulations.
|
||||
Since clipping affects only the synthetic OVERFLOW test without
|
||||
causing an int type overflow, it was moved outside the loop. */
|
||||
|
||||
/* R(x):=ac_v[-k+x]
|
||||
v += R(n-i)*ff_acelp_interp_filter(t+6i)
|
||||
v += R(n+i+1)*ff_acelp_interp_filter(6-t+6i) */
|
||||
|
||||
v += in[n + i] * filter_coeffs[idx + frac_pos];
|
||||
idx += precision;
|
||||
i++;
|
||||
v += in[n - i] * filter_coeffs[idx - frac_pos];
|
||||
}
|
||||
if(av_clip_int16(v>>15) != (v>>15))
|
||||
av_log(NULL, AV_LOG_WARNING, "overflow that would need cliping in ff_acelp_interpolate()\n");
|
||||
out[n] = v >> 15;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ff_acelp_high_pass_filter(
|
||||
int16_t* out,
|
||||
int hpf_f[2],
|
||||
const int16_t* in,
|
||||
int length)
|
||||
{
|
||||
int i;
|
||||
int tmp;
|
||||
|
||||
for(i=0; i<length; i++)
|
||||
{
|
||||
tmp = (hpf_f[0]* 15836LL)>>13;
|
||||
tmp += (hpf_f[1]* -7667LL)>>13;
|
||||
tmp += 7699 * (in[i] - 2*in[i-1] + in[i-2]);
|
||||
|
||||
/* With "+0x800" rounding, clipping is needed
|
||||
for ALGTHM and SPEECH tests. */
|
||||
out[i] = av_clip_int16((tmp + 0x800) >> 12);
|
||||
|
||||
hpf_f[1] = hpf_f[0];
|
||||
hpf_f[0] = tmp;
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* various filters for ACELP-based codecs
|
||||
*
|
||||
* Copyright (c) 2008 Vladimir Voroshilov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_ACELP_FILTERS_H
|
||||
#define AVCODEC_ACELP_FILTERS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* low-pass Finite Impulse Response filter coefficients.
|
||||
*
|
||||
* Hamming windowed sinc filter with cutoff freq 3/40 of the sampling freq,
|
||||
* the coefficients are scaled by 2^15.
|
||||
* This array only contains the right half of the filter.
|
||||
* This filter is likely identical to the one used in G.729, though this
|
||||
* could not be determined from the original comments with certainity.
|
||||
*/
|
||||
extern const int16_t ff_acelp_interp_filter[61];
|
||||
|
||||
/**
|
||||
* Generic FIR interpolation routine.
|
||||
* @param out [out] buffer for interpolated data
|
||||
* @param in input data
|
||||
* @param filter_coeffs interpolation filter coefficients (0.15)
|
||||
* @param precision sub sample factor, that is the precision of the position
|
||||
* @param frac_pos fractional part of position [0..precision-1]
|
||||
* @param filter_length filter length
|
||||
* @param length length of output
|
||||
*
|
||||
* filter_coeffs contains coefficients of the right half of the symmetric
|
||||
* interpolation filter. filter_coeffs[0] should the central (unpaired) coefficient.
|
||||
* See ff_acelp_interp_filter for an example.
|
||||
*
|
||||
*/
|
||||
void ff_acelp_interpolate(
|
||||
int16_t* out,
|
||||
const int16_t* in,
|
||||
const int16_t* filter_coeffs,
|
||||
int precision,
|
||||
int frac_pos,
|
||||
int filter_length,
|
||||
int length);
|
||||
|
||||
|
||||
/**
|
||||
* high-pass filtering and upscaling (4.2.5 of G.729).
|
||||
* @param out [out] output buffer for filtered speech data
|
||||
* @param hpf_f [in/out] past filtered data from previous (2 items long)
|
||||
* frames (-0x20000000 <= (14.13) < 0x20000000)
|
||||
* @param in speech data to process
|
||||
* @param length input data size
|
||||
*
|
||||
* out[i] = 0.93980581 * in[i] - 1.8795834 * in[i-1] + 0.93980581 * in[i-2] +
|
||||
* 1.9330735 * out[i-1] - 0.93589199 * out[i-2]
|
||||
*
|
||||
* The filter has a cut-off frequency of 1/80 of the sampling freq
|
||||
*
|
||||
* @note Two items before the top of the out buffer must contain two items from the
|
||||
* tail of the previous subframe.
|
||||
*
|
||||
* @remark It is safe to pass the same array in in and out parameters.
|
||||
*
|
||||
* @remark AMR uses mostly the same filter (cut-off frequency 60Hz, same formula,
|
||||
* but constants differs in 5th sign after comma). Fortunately in
|
||||
* fixed-point all coefficients are the same as in G.729. Thus this
|
||||
* routine can be used for the fixed-point AMR decoder, too.
|
||||
*/
|
||||
void ff_acelp_high_pass_filter(
|
||||
int16_t* out,
|
||||
int hpf_f[2],
|
||||
const int16_t* in,
|
||||
int length);
|
||||
|
||||
#endif /* AVCODEC_ACELP_FILTERS_H */
|
||||
@@ -1,121 +0,0 @@
|
||||
/*
|
||||
* gain code, gain pitch and pitch delay decoding
|
||||
*
|
||||
* Copyright (c) 2008 Vladimir Voroshilov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
#include "acelp_pitch_delay.h"
|
||||
#include "celp_math.h"
|
||||
|
||||
int ff_acelp_decode_8bit_to_1st_delay3(int ac_index)
|
||||
{
|
||||
ac_index += 58;
|
||||
if(ac_index > 254)
|
||||
ac_index = 3 * ac_index - 510;
|
||||
return ac_index;
|
||||
}
|
||||
|
||||
int ff_acelp_decode_4bit_to_2nd_delay3(
|
||||
int ac_index,
|
||||
int pitch_delay_min)
|
||||
{
|
||||
if(ac_index < 4)
|
||||
return 3 * (ac_index + pitch_delay_min);
|
||||
else if(ac_index < 12)
|
||||
return 3 * pitch_delay_min + ac_index + 6;
|
||||
else
|
||||
return 3 * (ac_index + pitch_delay_min) - 18;
|
||||
}
|
||||
|
||||
int ff_acelp_decode_5_6_bit_to_2nd_delay3(
|
||||
int ac_index,
|
||||
int pitch_delay_min)
|
||||
{
|
||||
return 3 * pitch_delay_min + ac_index - 2;
|
||||
}
|
||||
|
||||
int ff_acelp_decode_9bit_to_1st_delay6(int ac_index)
|
||||
{
|
||||
if(ac_index < 463)
|
||||
return ac_index + 105;
|
||||
else
|
||||
return 6 * (ac_index - 368);
|
||||
}
|
||||
int ff_acelp_decode_6bit_to_2nd_delay6(
|
||||
int ac_index,
|
||||
int pitch_delay_min)
|
||||
{
|
||||
return 6 * pitch_delay_min + ac_index - 3;
|
||||
}
|
||||
|
||||
void ff_acelp_update_past_gain(
|
||||
int16_t* quant_energy,
|
||||
int gain_corr_factor,
|
||||
int log2_ma_pred_order,
|
||||
int erasure)
|
||||
{
|
||||
int i;
|
||||
int avg_gain=quant_energy[(1 << log2_ma_pred_order) - 1]; // (5.10)
|
||||
|
||||
for(i=(1 << log2_ma_pred_order) - 1; i>0; i--)
|
||||
{
|
||||
avg_gain += quant_energy[i-1];
|
||||
quant_energy[i] = quant_energy[i-1];
|
||||
}
|
||||
|
||||
if(erasure)
|
||||
quant_energy[0] = FFMAX(avg_gain >> log2_ma_pred_order, -10240) - 4096; // -10 and -4 in (5.10)
|
||||
else
|
||||
quant_energy[0] = (6165 * ((ff_log2(gain_corr_factor) >> 2) - (13 << 13))) >> 13;
|
||||
}
|
||||
|
||||
int16_t ff_acelp_decode_gain_code(
|
||||
DSPContext *dsp,
|
||||
int gain_corr_factor,
|
||||
const int16_t* fc_v,
|
||||
int mr_energy,
|
||||
const int16_t* quant_energy,
|
||||
const int16_t* ma_prediction_coeff,
|
||||
int subframe_size,
|
||||
int ma_pred_order)
|
||||
{
|
||||
int i;
|
||||
|
||||
mr_energy <<= 10;
|
||||
|
||||
for(i=0; i<ma_pred_order; i++)
|
||||
mr_energy += quant_energy[i] * ma_prediction_coeff[i];
|
||||
|
||||
#ifdef G729_BITEXACT
|
||||
mr_energy += (((-6165LL * ff_log2(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size, 0))) >> 3) & ~0x3ff);
|
||||
|
||||
mr_energy = (5439 * (mr_energy >> 15)) >> 8; // (0.15) = (0.15) * (7.23)
|
||||
|
||||
return bidir_sal(
|
||||
((ff_exp2(mr_energy & 0x7fff) + 16) >> 5) * (gain_corr_factor >> 1),
|
||||
(mr_energy >> 15) - 25
|
||||
);
|
||||
#else
|
||||
mr_energy = gain_corr_factor * exp(M_LN10 / (20 << 23) * mr_energy) /
|
||||
sqrt(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size, 0));
|
||||
return mr_energy >> 12;
|
||||
#endif
|
||||
}
|
||||
@@ -1,223 +0,0 @@
|
||||
/*
|
||||
* gain code, gain pitch and pitch delay decoding
|
||||
*
|
||||
* Copyright (c) 2008 Vladimir Voroshilov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_ACELP_PITCH_DELAY_H
|
||||
#define AVCODEC_ACELP_PITCH_DELAY_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "dsputil.h"
|
||||
|
||||
#define PITCH_DELAY_MIN 20
|
||||
#define PITCH_DELAY_MAX 143
|
||||
|
||||
/**
|
||||
* \brief Decode pitch delay of the first subframe encoded by 8 bits with 1/3
|
||||
* resolution.
|
||||
* \param ac_index adaptive codebook index (8 bits)
|
||||
*
|
||||
* \return pitch delay in 1/3 units
|
||||
*
|
||||
* Pitch delay is coded:
|
||||
* with 1/3 resolution, 19 < pitch_delay < 85
|
||||
* integers only, 85 <= pitch_delay <= 143
|
||||
*/
|
||||
int ff_acelp_decode_8bit_to_1st_delay3(int ac_index);
|
||||
|
||||
/**
|
||||
* \brief Decode pitch delay of the second subframe encoded by 5 or 6 bits
|
||||
* with 1/3 precision.
|
||||
* \param ac_index adaptive codebook index (5 or 6 bits)
|
||||
* \param pitch_delay_min lower bound (integer) of pitch delay interval
|
||||
* for second subframe
|
||||
*
|
||||
* \return pitch delay in 1/3 units
|
||||
*
|
||||
* Pitch delay is coded:
|
||||
* with 1/3 resolution, -6 < pitch_delay - int(prev_pitch_delay) < 5
|
||||
*
|
||||
* \remark The routine is used in G.729 @8k, AMR @10.2k, AMR @7.95k,
|
||||
* AMR @7.4k for the second subframe.
|
||||
*/
|
||||
int ff_acelp_decode_5_6_bit_to_2nd_delay3(
|
||||
int ac_index,
|
||||
int pitch_delay_min);
|
||||
|
||||
/**
|
||||
* \brief Decode pitch delay with 1/3 precision.
|
||||
* \param ac_index adaptive codebook index (4 bits)
|
||||
* \param pitch_delay_min lower bound (integer) of pitch delay interval for
|
||||
* second subframe
|
||||
*
|
||||
* \return pitch delay in 1/3 units
|
||||
*
|
||||
* Pitch delay is coded:
|
||||
* integers only, -6 < pitch_delay - int(prev_pitch_delay) <= -2
|
||||
* with 1/3 resolution, -2 < pitch_delay - int(prev_pitch_delay) < 1
|
||||
* integers only, 1 <= pitch_delay - int(prev_pitch_delay) < 5
|
||||
*
|
||||
* \remark The routine is used in G.729 @6.4k, AMR @6.7k, AMR @5.9k,
|
||||
* AMR @5.15k, AMR @4.75k for the second subframe.
|
||||
*/
|
||||
int ff_acelp_decode_4bit_to_2nd_delay3(
|
||||
int ac_index,
|
||||
int pitch_delay_min);
|
||||
|
||||
/**
|
||||
* \brief Decode pitch delay of the first subframe encoded by 9 bits
|
||||
* with 1/6 precision.
|
||||
* \param ac_index adaptive codebook index (9 bits)
|
||||
* \param pitch_delay_min lower bound (integer) of pitch delay interval for
|
||||
* second subframe
|
||||
*
|
||||
* \return pitch delay in 1/6 units
|
||||
*
|
||||
* Pitch delay is coded:
|
||||
* with 1/6 resolution, 17 < pitch_delay < 95
|
||||
* integers only, 95 <= pitch_delay <= 143
|
||||
*
|
||||
* \remark The routine is used in AMR @12.2k for the first and third subframes.
|
||||
*/
|
||||
int ff_acelp_decode_9bit_to_1st_delay6(int ac_index);
|
||||
|
||||
/**
|
||||
* \brief Decode pitch delay of the second subframe encoded by 6 bits
|
||||
* with 1/6 precision.
|
||||
* \param ac_index adaptive codebook index (6 bits)
|
||||
* \param pitch_delay_min lower bound (integer) of pitch delay interval for
|
||||
* second subframe
|
||||
*
|
||||
* \return pitch delay in 1/6 units
|
||||
*
|
||||
* Pitch delay is coded:
|
||||
* with 1/6 resolution, -6 < pitch_delay - int(prev_pitch_delay) < 5
|
||||
*
|
||||
* \remark The routine is used in AMR @12.2k for the second and fourth subframes.
|
||||
*/
|
||||
int ff_acelp_decode_6bit_to_2nd_delay6(
|
||||
int ac_index,
|
||||
int pitch_delay_min);
|
||||
|
||||
/**
|
||||
* \brief Update past quantized energies
|
||||
* \param quant_energy [in/out] past quantized energies (5.10)
|
||||
* \param gain_corr_factor gain correction factor
|
||||
* \param log2_ma_pred_order log2() of MA prediction order
|
||||
* \param erasure frame erasure flag
|
||||
*
|
||||
* If frame erasure flag is not equal to zero, memory is updated with
|
||||
* averaged energy, attenuated by 4dB:
|
||||
* max(avg(quant_energy[i])-4, -14), i=0,ma_pred_order
|
||||
*
|
||||
* In normal mode memory is updated with
|
||||
* Er - Ep = 20 * log10(gain_corr_factor)
|
||||
*
|
||||
* \remark The routine is used in G.729 and AMR (all modes).
|
||||
*/
|
||||
void ff_acelp_update_past_gain(
|
||||
int16_t* quant_energy,
|
||||
int gain_corr_factor,
|
||||
int log2_ma_pred_order,
|
||||
int erasure);
|
||||
|
||||
/**
|
||||
* \brief Decode the adaptive codebook gain and add
|
||||
* correction (4.1.5 and 3.9.1 of G.729).
|
||||
* \param dsp initialized dsputil context
|
||||
* \param gain_corr_factor gain correction factor (2.13)
|
||||
* \param fc_v fixed-codebook vector (2.13)
|
||||
* \param mr_energy mean innovation energy and fixed-point correction (7.13)
|
||||
* \param quant_energy [in/out] past quantized energies (5.10)
|
||||
* \param subframe_size length of subframe
|
||||
* \param ma_pred_order MA prediction order
|
||||
*
|
||||
* \return quantized fixed-codebook gain (14.1)
|
||||
*
|
||||
* The routine implements equations 69, 66 and 71 of the G.729 specification (3.9.1)
|
||||
*
|
||||
* Em - mean innovation energy (dB, constant, depends on decoding algorithm)
|
||||
* Ep - mean-removed predicted energy (dB)
|
||||
* Er - mean-removed innovation energy (dB)
|
||||
* Ei - mean energy of the fixed-codebook contribution (dB)
|
||||
* N - subframe_size
|
||||
* M - MA (Moving Average) prediction order
|
||||
* gc - fixed-codebook gain
|
||||
* gc_p - predicted fixed-codebook gain
|
||||
*
|
||||
* Fixed codebook gain is computed using predicted gain gc_p and
|
||||
* correction factor gain_corr_factor as shown below:
|
||||
*
|
||||
* gc = gc_p * gain_corr_factor
|
||||
*
|
||||
* The predicted fixed codebook gain gc_p is found by predicting
|
||||
* the energy of the fixed-codebook contribution from the energy
|
||||
* of previous fixed-codebook contributions.
|
||||
*
|
||||
* mean = 1/N * sum(i,0,N){ fc_v[i] * fc_v[i] }
|
||||
*
|
||||
* Ei = 10log(mean)
|
||||
*
|
||||
* Er = 10log(1/N * gc^2 * mean) - Em = 20log(gc) + Ei - Em
|
||||
*
|
||||
* Replacing Er with Ep and gc with gc_p we will receive:
|
||||
*
|
||||
* Ep = 10log(1/N * gc_p^2 * mean) - Em = 20log(gc_p) + Ei - Em
|
||||
*
|
||||
* and from above:
|
||||
*
|
||||
* gc_p = 10^((Ep - Ei + Em) / 20)
|
||||
*
|
||||
* Ep is predicted using past energies and prediction coefficients:
|
||||
*
|
||||
* Ep = sum(i,0,M){ ma_prediction_coeff[i] * quant_energy[i] }
|
||||
*
|
||||
* gc_p in fixed-point arithmetic is calculated as following:
|
||||
*
|
||||
* mean = 1/N * sum(i,0,N){ (fc_v[i] / 2^13) * (fc_v[i] / 2^13) } =
|
||||
* = 1/N * sum(i,0,N) { fc_v[i] * fc_v[i] } / 2^26
|
||||
*
|
||||
* Ei = 10log(mean) = -10log(N) - 10log(2^26) +
|
||||
* + 10log(sum(i,0,N) { fc_v[i] * fc_v[i] })
|
||||
*
|
||||
* Ep - Ei + Em = Ep + Em + 10log(N) + 10log(2^26) -
|
||||
* - 10log(sum(i,0,N) { fc_v[i] * fc_v[i] }) =
|
||||
* = Ep + mr_energy - 10log(sum(i,0,N) { fc_v[i] * fc_v[i] })
|
||||
*
|
||||
* gc_p = 10 ^ ((Ep - Ei + Em) / 20) =
|
||||
* = 2 ^ (3.3219 * (Ep - Ei + Em) / 20) = 2 ^ (0.166 * (Ep - Ei + Em))
|
||||
*
|
||||
* where
|
||||
*
|
||||
* mr_energy = Em + 10log(N) + 10log(2^26)
|
||||
*
|
||||
* \remark The routine is used in G.729 and AMR (all modes).
|
||||
*/
|
||||
int16_t ff_acelp_decode_gain_code(
|
||||
DSPContext *dsp,
|
||||
int gain_corr_factor,
|
||||
const int16_t* fc_v,
|
||||
int mr_energy,
|
||||
const int16_t* quant_energy,
|
||||
const int16_t* ma_prediction_coeff,
|
||||
int subframe_size,
|
||||
int max_pred_order);
|
||||
|
||||
#endif /* AVCODEC_ACELP_PITCH_DELAY_H */
|
||||
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* adaptive and fixed codebook vector operations for ACELP-based codecs
|
||||
*
|
||||
* Copyright (c) 2008 Vladimir Voroshilov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "avcodec.h"
|
||||
#include "acelp_vectors.h"
|
||||
|
||||
const uint8_t ff_fc_2pulses_9bits_track1[16] =
|
||||
{
|
||||
1, 3,
|
||||
6, 8,
|
||||
11, 13,
|
||||
16, 18,
|
||||
21, 23,
|
||||
26, 28,
|
||||
31, 33,
|
||||
36, 38
|
||||
};
|
||||
const uint8_t ff_fc_2pulses_9bits_track1_gray[16] =
|
||||
{
|
||||
1, 3,
|
||||
8, 6,
|
||||
18, 16,
|
||||
11, 13,
|
||||
38, 36,
|
||||
31, 33,
|
||||
21, 23,
|
||||
28, 26,
|
||||
};
|
||||
|
||||
const uint8_t ff_fc_2pulses_9bits_track2_gray[32] =
|
||||
{
|
||||
0, 2,
|
||||
5, 4,
|
||||
12, 10,
|
||||
7, 9,
|
||||
25, 24,
|
||||
20, 22,
|
||||
14, 15,
|
||||
19, 17,
|
||||
36, 31,
|
||||
21, 26,
|
||||
1, 6,
|
||||
16, 11,
|
||||
27, 29,
|
||||
32, 30,
|
||||
39, 37,
|
||||
34, 35,
|
||||
};
|
||||
|
||||
const uint8_t ff_fc_4pulses_8bits_tracks_13[16] =
|
||||
{
|
||||
0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75,
|
||||
};
|
||||
|
||||
const uint8_t ff_fc_4pulses_8bits_track_4[32] =
|
||||
{
|
||||
3, 4,
|
||||
8, 9,
|
||||
13, 14,
|
||||
18, 19,
|
||||
23, 24,
|
||||
28, 29,
|
||||
33, 34,
|
||||
38, 39,
|
||||
43, 44,
|
||||
48, 49,
|
||||
53, 54,
|
||||
58, 59,
|
||||
63, 64,
|
||||
68, 69,
|
||||
73, 74,
|
||||
78, 79,
|
||||
};
|
||||
|
||||
#if 0
|
||||
static uint8_t gray_decode[32] =
|
||||
{
|
||||
0, 1, 3, 2, 7, 6, 4, 5,
|
||||
15, 14, 12, 13, 8, 9, 11, 10,
|
||||
31, 30, 28, 29, 24, 25, 27, 26,
|
||||
16, 17, 19, 18, 23, 22, 20, 21
|
||||
};
|
||||
#endif
|
||||
|
||||
void ff_acelp_fc_pulse_per_track(
|
||||
int16_t* fc_v,
|
||||
const uint8_t *tab1,
|
||||
const uint8_t *tab2,
|
||||
int pulse_indexes,
|
||||
int pulse_signs,
|
||||
int pulse_count,
|
||||
int bits)
|
||||
{
|
||||
int mask = (1 << bits) - 1;
|
||||
int i;
|
||||
|
||||
for(i=0; i<pulse_count; i++)
|
||||
{
|
||||
fc_v[i + tab1[pulse_indexes & mask]] +=
|
||||
(pulse_signs & 1) ? 8191 : -8192; // +/-1 in (2.13)
|
||||
|
||||
pulse_indexes >>= bits;
|
||||
pulse_signs >>= 1;
|
||||
}
|
||||
|
||||
fc_v[tab2[pulse_indexes]] += (pulse_signs & 1) ? 8191 : -8192;
|
||||
}
|
||||
|
||||
void ff_acelp_weighted_vector_sum(
|
||||
int16_t* out,
|
||||
const int16_t *in_a,
|
||||
const int16_t *in_b,
|
||||
int16_t weight_coeff_a,
|
||||
int16_t weight_coeff_b,
|
||||
int16_t rounder,
|
||||
int shift,
|
||||
int length)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Clipping required here; breaks OVERFLOW test.
|
||||
for(i=0; i<length; i++)
|
||||
out[i] = av_clip_int16((
|
||||
in_a[i] * weight_coeff_a +
|
||||
in_b[i] * weight_coeff_b +
|
||||
rounder) >> shift);
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* adaptive and fixed codebook vector operations for ACELP-based codecs
|
||||
*
|
||||
* Copyright (c) 2008 Vladimir Voroshilov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_ACELP_VECTORS_H
|
||||
#define AVCODEC_ACELP_VECTORS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Track|Pulse| Positions
|
||||
* -------------------------------------------------------------------------
|
||||
* 1 | 0 | 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75
|
||||
* -------------------------------------------------------------------------
|
||||
* 2 | 1 | 1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76
|
||||
* -------------------------------------------------------------------------
|
||||
* 3 | 2 | 2, 7, 12, 17, 22, 27, 32, 37, 42, 47, 52, 57, 62, 67, 72, 77
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Table contains only first the pulse indexes.
|
||||
*
|
||||
* Used in G.729 @8k, G.729 @4.4k, AMR @7.95k, AMR @7.40k
|
||||
*/
|
||||
extern const uint8_t ff_fc_4pulses_8bits_tracks_13[16];
|
||||
|
||||
/**
|
||||
* Track|Pulse| Positions
|
||||
* -------------------------------------------------------------------------
|
||||
* 4 | 3 | 3, 8, 13, 18, 23, 28, 33, 38, 43, 48, 53, 58, 63, 68, 73, 78
|
||||
* | | 4, 9, 14, 19, 24, 29, 34, 39, 44, 49, 54, 59, 64, 69, 74, 79
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* @remark Track in the table should be read top-to-bottom, left-to-right.
|
||||
*
|
||||
* Used in G.729 @8k, G.729 @4.4k, AMR @7.95k, AMR @7.40k
|
||||
*/
|
||||
extern const uint8_t ff_fc_4pulses_8bits_track_4[32];
|
||||
|
||||
/**
|
||||
* Track|Pulse| Positions
|
||||
* -----------------------------------------
|
||||
* 1 | 0 | 1, 6, 11, 16, 21, 26, 31, 36
|
||||
* | | 3, 8, 13, 18, 23, 28, 33, 38
|
||||
* -----------------------------------------
|
||||
*
|
||||
* @remark Track in the table should be read top-to-bottom, left-to-right.
|
||||
*
|
||||
* @note (EE) Reference G.729D code also uses gray decoding for each
|
||||
* pulse index before looking up the value in the table.
|
||||
*
|
||||
* Used in G.729 @6.4k (with gray coding), AMR @5.9k (without gray coding)
|
||||
*/
|
||||
extern const uint8_t ff_fc_2pulses_9bits_track1[16];
|
||||
extern const uint8_t ff_fc_2pulses_9bits_track1_gray[16];
|
||||
|
||||
/**
|
||||
* Track|Pulse| Positions
|
||||
* -----------------------------------------
|
||||
* 2 | 1 | 0, 7, 14, 20, 27, 34, 1, 21
|
||||
* | | 2, 9, 15, 22, 29, 35, 6, 26
|
||||
* | | 4,10, 17, 24, 30, 37, 11, 31
|
||||
* | | 5,12, 19, 25, 32, 39, 16, 36
|
||||
* -----------------------------------------
|
||||
*
|
||||
* @remark Track in the table should be read top-to-bottom, left-to-right.
|
||||
*
|
||||
* @note (EE.1) This table (from the reference code) does not comply with
|
||||
* the specification.
|
||||
* The specification contains the following table:
|
||||
*
|
||||
* Track|Pulse| Positions
|
||||
* -----------------------------------------
|
||||
* 2 | 1 | 0, 5, 10, 15, 20, 25, 30, 35
|
||||
* | | 1, 6, 11, 16, 21, 26, 31, 36
|
||||
* | | 2, 7, 12, 17, 22, 27, 32, 37
|
||||
* | | 4, 9, 14, 19, 24, 29, 34, 39
|
||||
*
|
||||
* -----------------------------------------
|
||||
*
|
||||
* @note (EE.2) Reference G.729D code also uses gray decoding for each
|
||||
* pulse index before looking up the value in the table.
|
||||
*
|
||||
* Used in G.729 @6.4k (with gray coding)
|
||||
*/
|
||||
extern const uint8_t ff_fc_2pulses_9bits_track2_gray[32];
|
||||
|
||||
/**
|
||||
* Decode fixed-codebook vector (3.8 and D.5.8 of G.729, 5.7.1 of AMR).
|
||||
* @param fc_v [out] decoded fixed codebook vector (2.13)
|
||||
* @param tab1 table used for first pulse_count pulses
|
||||
* @param tab2 table used for last pulse
|
||||
* @param pulse_indexes fixed codebook indexes
|
||||
* @param pulse_signs signs of the excitation pulses (0 bit value
|
||||
* means negative sign)
|
||||
* @param bits number of bits per one pulse index
|
||||
* @param pulse_count number of pulses decoded using first table
|
||||
* @param bits length of one pulse index in bits
|
||||
*
|
||||
* Used in G.729 @8k, G.729 @4.4k, G.729 @6.4k, AMR @7.95k, AMR @7.40k
|
||||
*/
|
||||
void ff_acelp_fc_pulse_per_track(
|
||||
int16_t* fc_v,
|
||||
const uint8_t *tab1,
|
||||
const uint8_t *tab2,
|
||||
int pulse_indexes,
|
||||
int pulse_signs,
|
||||
int pulse_count,
|
||||
int bits);
|
||||
|
||||
/**
|
||||
* weighted sum of two vectors with rounding.
|
||||
* @param out [out] result of addition
|
||||
* @param in_a first vector
|
||||
* @param in_b second vector
|
||||
* @param weight_coeff_a first vector weight coefficient
|
||||
* @param weight_coeff_a second vector weight coefficient
|
||||
* @param rounder this value will be added to the sum of the two vectors
|
||||
* @param shift result will be shifted to right by this value
|
||||
* @param length vectors length
|
||||
*
|
||||
* @note It is safe to pass the same buffer for out and in_a or in_b.
|
||||
*
|
||||
* out[i] = (in_a[i]*weight_a + in_b[i]*weight_b + rounder) >> shift
|
||||
*/
|
||||
void ff_acelp_weighted_vector_sum(
|
||||
int16_t* out,
|
||||
const int16_t *in_a,
|
||||
const int16_t *in_b,
|
||||
int16_t weight_coeff_a,
|
||||
int16_t weight_coeff_b,
|
||||
int16_t rounder,
|
||||
int shift,
|
||||
int length);
|
||||
|
||||
#endif /* AVCODEC_ACELP_VECTORS_H */
|
||||
-1690
File diff suppressed because it is too large
Load Diff
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* ADX ADPCM codecs
|
||||
* Copyright (c) 2001,2003 BERO
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/adx.h
|
||||
* SEGA CRI adx codecs.
|
||||
*
|
||||
* Reference documents:
|
||||
* http://ku-www.ss.titech.ac.jp/~yatsushi/adx.html
|
||||
* adx2wav & wav2adx http://www.geocities.co.jp/Playtown/2004/
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_ADX_H
|
||||
#define AVCODEC_ADX_H
|
||||
|
||||
typedef struct {
|
||||
int s1,s2;
|
||||
} PREV;
|
||||
|
||||
typedef struct {
|
||||
PREV prev[2];
|
||||
int header_parsed;
|
||||
unsigned char dec_temp[18*2];
|
||||
int in_temp;
|
||||
} ADXContext;
|
||||
|
||||
#define BASEVOL 0x4000
|
||||
#define SCALE1 0x7298
|
||||
#define SCALE2 0x3350
|
||||
|
||||
#endif /* AVCODEC_ADX_H */
|
||||
@@ -1,178 +0,0 @@
|
||||
/*
|
||||
* ADX ADPCM codecs
|
||||
* Copyright (c) 2001,2003 BERO
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "avcodec.h"
|
||||
#include "adx.h"
|
||||
|
||||
/**
|
||||
* @file libavcodec/adxdec.c
|
||||
* SEGA CRI adx codecs.
|
||||
*
|
||||
* Reference documents:
|
||||
* http://ku-www.ss.titech.ac.jp/~yatsushi/adx.html
|
||||
* adx2wav & wav2adx http://www.geocities.co.jp/Playtown/2004/
|
||||
*/
|
||||
|
||||
static av_cold int adx_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 18 bytes <-> 32 samples */
|
||||
|
||||
static void adx_decode(short *out,const unsigned char *in,PREV *prev)
|
||||
{
|
||||
int scale = AV_RB16(in);
|
||||
int i;
|
||||
int s0,s1,s2,d;
|
||||
|
||||
// printf("%x ",scale);
|
||||
|
||||
in+=2;
|
||||
s1 = prev->s1;
|
||||
s2 = prev->s2;
|
||||
for(i=0;i<16;i++) {
|
||||
d = in[i];
|
||||
// d>>=4; if (d&8) d-=16;
|
||||
d = ((signed char)d >> 4);
|
||||
s0 = (BASEVOL*d*scale + SCALE1*s1 - SCALE2*s2)>>14;
|
||||
s2 = s1;
|
||||
s1 = av_clip_int16(s0);
|
||||
*out++=s1;
|
||||
|
||||
d = in[i];
|
||||
//d&=15; if (d&8) d-=16;
|
||||
d = ((signed char)(d<<4) >> 4);
|
||||
s0 = (BASEVOL*d*scale + SCALE1*s1 - SCALE2*s2)>>14;
|
||||
s2 = s1;
|
||||
s1 = av_clip_int16(s0);
|
||||
*out++=s1;
|
||||
}
|
||||
prev->s1 = s1;
|
||||
prev->s2 = s2;
|
||||
|
||||
}
|
||||
|
||||
static void adx_decode_stereo(short *out,const unsigned char *in,PREV *prev)
|
||||
{
|
||||
short tmp[32*2];
|
||||
int i;
|
||||
|
||||
adx_decode(tmp ,in ,prev);
|
||||
adx_decode(tmp+32,in+18,prev+1);
|
||||
for(i=0;i<32;i++) {
|
||||
out[i*2] = tmp[i];
|
||||
out[i*2+1] = tmp[i+32];
|
||||
}
|
||||
}
|
||||
|
||||
/* return data offset or 0 */
|
||||
static int adx_decode_header(AVCodecContext *avctx,const unsigned char *buf,size_t bufsize)
|
||||
{
|
||||
int offset;
|
||||
|
||||
if (buf[0]!=0x80) return 0;
|
||||
offset = (AV_RB32(buf)^0x80000000)+4;
|
||||
if (bufsize<offset || memcmp(buf+offset-6,"(c)CRI",6)) return 0;
|
||||
|
||||
avctx->channels = buf[7];
|
||||
avctx->sample_rate = AV_RB32(buf+8);
|
||||
avctx->bit_rate = avctx->sample_rate*avctx->channels*18*8/32;
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static int adx_decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *data_size,
|
||||
const uint8_t *buf0, int buf_size)
|
||||
{
|
||||
ADXContext *c = avctx->priv_data;
|
||||
short *samples = data;
|
||||
const uint8_t *buf = buf0;
|
||||
int rest = buf_size;
|
||||
|
||||
if (!c->header_parsed) {
|
||||
int hdrsize = adx_decode_header(avctx,buf,rest);
|
||||
if (hdrsize==0) return -1;
|
||||
c->header_parsed = 1;
|
||||
buf += hdrsize;
|
||||
rest -= hdrsize;
|
||||
}
|
||||
|
||||
/* 18 bytes of data are expanded into 32*2 bytes of audio,
|
||||
so guard against buffer overflows */
|
||||
if(rest/18 > *data_size/64)
|
||||
rest = (*data_size/64) * 18;
|
||||
|
||||
if (c->in_temp) {
|
||||
int copysize = 18*avctx->channels - c->in_temp;
|
||||
memcpy(c->dec_temp+c->in_temp,buf,copysize);
|
||||
rest -= copysize;
|
||||
buf += copysize;
|
||||
if (avctx->channels==1) {
|
||||
adx_decode(samples,c->dec_temp,c->prev);
|
||||
samples += 32;
|
||||
} else {
|
||||
adx_decode_stereo(samples,c->dec_temp,c->prev);
|
||||
samples += 32*2;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (avctx->channels==1) {
|
||||
while(rest>=18) {
|
||||
adx_decode(samples,buf,c->prev);
|
||||
rest-=18;
|
||||
buf+=18;
|
||||
samples+=32;
|
||||
}
|
||||
} else {
|
||||
while(rest>=18*2) {
|
||||
adx_decode_stereo(samples,buf,c->prev);
|
||||
rest-=18*2;
|
||||
buf+=18*2;
|
||||
samples+=32*2;
|
||||
}
|
||||
}
|
||||
//
|
||||
c->in_temp = rest;
|
||||
if (rest) {
|
||||
memcpy(c->dec_temp,buf,rest);
|
||||
buf+=rest;
|
||||
}
|
||||
*data_size = (uint8_t*)samples - (uint8_t*)data;
|
||||
// printf("%d:%d ",buf-buf0,*data_size); fflush(stdout);
|
||||
return buf-buf0;
|
||||
}
|
||||
|
||||
AVCodec adpcm_adx_decoder = {
|
||||
"adpcm_adx",
|
||||
CODEC_TYPE_AUDIO,
|
||||
CODEC_ID_ADPCM_ADX,
|
||||
sizeof(ADXContext),
|
||||
adx_decode_init,
|
||||
NULL,
|
||||
NULL,
|
||||
adx_decode_frame,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"),
|
||||
};
|
||||
|
||||
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* ADX ADPCM codecs
|
||||
* Copyright (c) 2001,2003 BERO
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "avcodec.h"
|
||||
#include "adx.h"
|
||||
|
||||
/**
|
||||
* @file libavcodec/adxenc.c
|
||||
* SEGA CRI adx codecs.
|
||||
*
|
||||
* Reference documents:
|
||||
* http://ku-www.ss.titech.ac.jp/~yatsushi/adx.html
|
||||
* adx2wav & wav2adx http://www.geocities.co.jp/Playtown/2004/
|
||||
*/
|
||||
|
||||
/* 18 bytes <-> 32 samples */
|
||||
|
||||
static void adx_encode(unsigned char *adx,const short *wav,PREV *prev)
|
||||
{
|
||||
int scale;
|
||||
int i;
|
||||
int s0,s1,s2,d;
|
||||
int max=0;
|
||||
int min=0;
|
||||
int data[32];
|
||||
|
||||
s1 = prev->s1;
|
||||
s2 = prev->s2;
|
||||
for(i=0;i<32;i++) {
|
||||
s0 = wav[i];
|
||||
d = ((s0<<14) - SCALE1*s1 + SCALE2*s2)/BASEVOL;
|
||||
data[i]=d;
|
||||
if (max<d) max=d;
|
||||
if (min>d) min=d;
|
||||
s2 = s1;
|
||||
s1 = s0;
|
||||
}
|
||||
prev->s1 = s1;
|
||||
prev->s2 = s2;
|
||||
|
||||
/* -8..+7 */
|
||||
|
||||
if (max==0 && min==0) {
|
||||
memset(adx,0,18);
|
||||
return;
|
||||
}
|
||||
|
||||
if (max/7>-min/8) scale = max/7;
|
||||
else scale = -min/8;
|
||||
|
||||
if (scale==0) scale=1;
|
||||
|
||||
AV_WB16(adx, scale);
|
||||
|
||||
for(i=0;i<16;i++) {
|
||||
adx[i+2] = ((data[i*2]/scale)<<4) | ((data[i*2+1]/scale)&0xf);
|
||||
}
|
||||
}
|
||||
|
||||
static int adx_encode_header(AVCodecContext *avctx,unsigned char *buf,size_t bufsize)
|
||||
{
|
||||
#if 0
|
||||
struct {
|
||||
uint32_t offset; /* 0x80000000 + sample start - 4 */
|
||||
unsigned char unknown1[3]; /* 03 12 04 */
|
||||
unsigned char channel; /* 1 or 2 */
|
||||
uint32_t freq;
|
||||
uint32_t size;
|
||||
uint32_t unknown2; /* 01 f4 03 00 */
|
||||
uint32_t unknown3; /* 00 00 00 00 */
|
||||
uint32_t unknown4; /* 00 00 00 00 */
|
||||
|
||||
/* if loop
|
||||
unknown3 00 15 00 01
|
||||
unknown4 00 00 00 01
|
||||
long loop_start_sample;
|
||||
long loop_start_byte;
|
||||
long loop_end_sample;
|
||||
long loop_end_byte;
|
||||
long
|
||||
*/
|
||||
} adxhdr; /* big endian */
|
||||
/* offset-6 "(c)CRI" */
|
||||
#endif
|
||||
AV_WB32(buf+0x00,0x80000000|0x20);
|
||||
AV_WB32(buf+0x04,0x03120400|avctx->channels);
|
||||
AV_WB32(buf+0x08,avctx->sample_rate);
|
||||
AV_WB32(buf+0x0c,0); /* FIXME: set after */
|
||||
AV_WB32(buf+0x10,0x01040300);
|
||||
AV_WB32(buf+0x14,0x00000000);
|
||||
AV_WB32(buf+0x18,0x00000000);
|
||||
memcpy(buf+0x1c,"\0\0(c)CRI",8);
|
||||
return 0x20+4;
|
||||
}
|
||||
|
||||
static av_cold int adx_encode_init(AVCodecContext *avctx)
|
||||
{
|
||||
if (avctx->channels > 2)
|
||||
return -1; /* only stereo or mono =) */
|
||||
avctx->frame_size = 32;
|
||||
|
||||
avctx->coded_frame= avcodec_alloc_frame();
|
||||
avctx->coded_frame->key_frame= 1;
|
||||
|
||||
// avctx->bit_rate = avctx->sample_rate*avctx->channels*18*8/32;
|
||||
|
||||
av_log(avctx, AV_LOG_DEBUG, "adx encode init\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static av_cold int adx_encode_close(AVCodecContext *avctx)
|
||||
{
|
||||
av_freep(&avctx->coded_frame);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int adx_encode_frame(AVCodecContext *avctx,
|
||||
uint8_t *frame, int buf_size, void *data)
|
||||
{
|
||||
ADXContext *c = avctx->priv_data;
|
||||
const short *samples = data;
|
||||
unsigned char *dst = frame;
|
||||
int rest = avctx->frame_size;
|
||||
|
||||
/*
|
||||
input data size =
|
||||
ffmpeg.c: do_audio_out()
|
||||
frame_bytes = enc->frame_size * 2 * enc->channels;
|
||||
*/
|
||||
|
||||
// printf("sz=%d ",buf_size); fflush(stdout);
|
||||
if (!c->header_parsed) {
|
||||
int hdrsize = adx_encode_header(avctx,dst,buf_size);
|
||||
dst+=hdrsize;
|
||||
c->header_parsed = 1;
|
||||
}
|
||||
|
||||
if (avctx->channels==1) {
|
||||
while(rest>=32) {
|
||||
adx_encode(dst,samples,c->prev);
|
||||
dst+=18;
|
||||
samples+=32;
|
||||
rest-=32;
|
||||
}
|
||||
} else {
|
||||
while(rest>=32*2) {
|
||||
short tmpbuf[32*2];
|
||||
int i;
|
||||
|
||||
for(i=0;i<32;i++) {
|
||||
tmpbuf[i] = samples[i*2];
|
||||
tmpbuf[i+32] = samples[i*2+1];
|
||||
}
|
||||
|
||||
adx_encode(dst,tmpbuf,c->prev);
|
||||
adx_encode(dst+18,tmpbuf+32,c->prev+1);
|
||||
dst+=18*2;
|
||||
samples+=32*2;
|
||||
rest-=32*2;
|
||||
}
|
||||
}
|
||||
return dst-frame;
|
||||
}
|
||||
|
||||
AVCodec adpcm_adx_encoder = {
|
||||
"adpcm_adx",
|
||||
CODEC_TYPE_AUDIO,
|
||||
CODEC_ID_ADPCM_ADX,
|
||||
sizeof(ADXContext),
|
||||
adx_encode_init,
|
||||
adx_encode_frame,
|
||||
adx_encode_close,
|
||||
NULL,
|
||||
.sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
||||
.long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"),
|
||||
};
|
||||
@@ -1,629 +0,0 @@
|
||||
/*
|
||||
* ALAC (Apple Lossless Audio Codec) decoder
|
||||
* Copyright (c) 2005 David Hammerton
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file libavcodec/alac.c
|
||||
* ALAC (Apple Lossless Audio Codec) decoder
|
||||
* @author 2005 David Hammerton
|
||||
*
|
||||
* For more information on the ALAC format, visit:
|
||||
* http://crazney.net/programs/itunes/alac.html
|
||||
*
|
||||
* Note: This decoder expects a 36- (0x24-)byte QuickTime atom to be
|
||||
* passed through the extradata[_size] fields. This atom is tacked onto
|
||||
* the end of an 'alac' stsd atom and has the following format:
|
||||
* bytes 0-3 atom size (0x24), big-endian
|
||||
* bytes 4-7 atom type ('alac', not the 'alac' tag from start of stsd)
|
||||
* bytes 8-35 data bytes needed by decoder
|
||||
*
|
||||
* Extradata:
|
||||
* 32bit size
|
||||
* 32bit tag (=alac)
|
||||
* 32bit zero?
|
||||
* 32bit max sample per frame
|
||||
* 8bit ?? (zero?)
|
||||
* 8bit sample size
|
||||
* 8bit history mult
|
||||
* 8bit initial history
|
||||
* 8bit kmodifier
|
||||
* 8bit channels?
|
||||
* 16bit ??
|
||||
* 32bit max coded frame size
|
||||
* 32bit bitrate?
|
||||
* 32bit samplerate
|
||||
*/
|
||||
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "bitstream.h"
|
||||
#include "bytestream.h"
|
||||
#include "unary.h"
|
||||
|
||||
#define ALAC_EXTRADATA_SIZE 36
|
||||
#define MAX_CHANNELS 2
|
||||
|
||||
typedef struct {
|
||||
|
||||
AVCodecContext *avctx;
|
||||
GetBitContext gb;
|
||||
/* init to 0; first frame decode should initialize from extradata and
|
||||
* set this to 1 */
|
||||
int context_initialized;
|
||||
|
||||
int numchannels;
|
||||
int bytespersample;
|
||||
|
||||
/* buffers */
|
||||
int32_t *predicterror_buffer[MAX_CHANNELS];
|
||||
|
||||
int32_t *outputsamples_buffer[MAX_CHANNELS];
|
||||
|
||||
/* stuff from setinfo */
|
||||
uint32_t setinfo_max_samples_per_frame; /* 0x1000 = 4096 */ /* max samples per frame? */
|
||||
uint8_t setinfo_sample_size; /* 0x10 */
|
||||
uint8_t setinfo_rice_historymult; /* 0x28 */
|
||||
uint8_t setinfo_rice_initialhistory; /* 0x0a */
|
||||
uint8_t setinfo_rice_kmodifier; /* 0x0e */
|
||||
/* end setinfo stuff */
|
||||
|
||||
} ALACContext;
|
||||
|
||||
static void allocate_buffers(ALACContext *alac)
|
||||
{
|
||||
int chan;
|
||||
for (chan = 0; chan < MAX_CHANNELS; chan++) {
|
||||
alac->predicterror_buffer[chan] =
|
||||
av_malloc(alac->setinfo_max_samples_per_frame * 4);
|
||||
|
||||
alac->outputsamples_buffer[chan] =
|
||||
av_malloc(alac->setinfo_max_samples_per_frame * 4);
|
||||
}
|
||||
}
|
||||
|
||||
static int alac_set_info(ALACContext *alac)
|
||||
{
|
||||
const unsigned char *ptr = alac->avctx->extradata;
|
||||
|
||||
ptr += 4; /* size */
|
||||
ptr += 4; /* alac */
|
||||
ptr += 4; /* 0 ? */
|
||||
|
||||
if(AV_RB32(ptr) >= UINT_MAX/4){
|
||||
av_log(alac->avctx, AV_LOG_ERROR, "setinfo_max_samples_per_frame too large\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* buffer size / 2 ? */
|
||||
alac->setinfo_max_samples_per_frame = bytestream_get_be32(&ptr);
|
||||
ptr++; /* ??? */
|
||||
alac->setinfo_sample_size = *ptr++;
|
||||
if (alac->setinfo_sample_size > 32) {
|
||||
av_log(alac->avctx, AV_LOG_ERROR, "setinfo_sample_size too large\n");
|
||||
return -1;
|
||||
}
|
||||
alac->setinfo_rice_historymult = *ptr++;
|
||||
alac->setinfo_rice_initialhistory = *ptr++;
|
||||
alac->setinfo_rice_kmodifier = *ptr++;
|
||||
ptr++; /* channels? */
|
||||
bytestream_get_be16(&ptr); /* ??? */
|
||||
bytestream_get_be32(&ptr); /* max coded frame size */
|
||||
bytestream_get_be32(&ptr); /* bitrate ? */
|
||||
bytestream_get_be32(&ptr); /* samplerate */
|
||||
|
||||
allocate_buffers(alac);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int decode_scalar(GetBitContext *gb, int k, int limit, int readsamplesize){
|
||||
/* read x - number of 1s before 0 represent the rice */
|
||||
int x = get_unary_0_9(gb);
|
||||
|
||||
if (x > 8) { /* RICE THRESHOLD */
|
||||
/* use alternative encoding */
|
||||
x = get_bits(gb, readsamplesize);
|
||||
} else {
|
||||
if (k >= limit)
|
||||
k = limit;
|
||||
|
||||
if (k != 1) {
|
||||
int extrabits = show_bits(gb, k);
|
||||
|
||||
/* multiply x by 2^k - 1, as part of their strange algorithm */
|
||||
x = (x << k) - x;
|
||||
|
||||
if (extrabits > 1) {
|
||||
x += extrabits - 1;
|
||||
skip_bits(gb, k);
|
||||
} else
|
||||
skip_bits(gb, k - 1);
|
||||
}
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
static void bastardized_rice_decompress(ALACContext *alac,
|
||||
int32_t *output_buffer,
|
||||
int output_size,
|
||||
int readsamplesize, /* arg_10 */
|
||||
int rice_initialhistory, /* arg424->b */
|
||||
int rice_kmodifier, /* arg424->d */
|
||||
int rice_historymult, /* arg424->c */
|
||||
int rice_kmodifier_mask /* arg424->e */
|
||||
)
|
||||
{
|
||||
int output_count;
|
||||
unsigned int history = rice_initialhistory;
|
||||
int sign_modifier = 0;
|
||||
|
||||
for (output_count = 0; output_count < output_size; output_count++) {
|
||||
int32_t x;
|
||||
int32_t x_modified;
|
||||
int32_t final_val;
|
||||
|
||||
/* standard rice encoding */
|
||||
int k; /* size of extra bits */
|
||||
|
||||
/* read k, that is bits as is */
|
||||
k = av_log2((history >> 9) + 3);
|
||||
x= decode_scalar(&alac->gb, k, rice_kmodifier, readsamplesize);
|
||||
|
||||
x_modified = sign_modifier + x;
|
||||
final_val = (x_modified + 1) / 2;
|
||||
if (x_modified & 1) final_val *= -1;
|
||||
|
||||
output_buffer[output_count] = final_val;
|
||||
|
||||
sign_modifier = 0;
|
||||
|
||||
/* now update the history */
|
||||
history += x_modified * rice_historymult
|
||||
- ((history * rice_historymult) >> 9);
|
||||
|
||||
if (x_modified > 0xffff)
|
||||
history = 0xffff;
|
||||
|
||||
/* special case: there may be compressed blocks of 0 */
|
||||
if ((history < 128) && (output_count+1 < output_size)) {
|
||||
int k;
|
||||
unsigned int block_size;
|
||||
|
||||
sign_modifier = 1;
|
||||
|
||||
k = 7 - av_log2(history) + ((history + 16) >> 6 /* / 64 */);
|
||||
|
||||
block_size= decode_scalar(&alac->gb, k, rice_kmodifier, 16);
|
||||
|
||||
if (block_size > 0) {
|
||||
if(block_size >= output_size - output_count){
|
||||
av_log(alac->avctx, AV_LOG_ERROR, "invalid zero block size of %d %d %d\n", block_size, output_size, output_count);
|
||||
block_size= output_size - output_count - 1;
|
||||
}
|
||||
memset(&output_buffer[output_count+1], 0, block_size * 4);
|
||||
output_count += block_size;
|
||||
}
|
||||
|
||||
if (block_size > 0xffff)
|
||||
sign_modifier = 0;
|
||||
|
||||
history = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline int32_t extend_sign32(int32_t val, int bits)
|
||||
{
|
||||
return (val << (32 - bits)) >> (32 - bits);
|
||||
}
|
||||
|
||||
static inline int sign_only(int v)
|
||||
{
|
||||
return v ? FFSIGN(v) : 0;
|
||||
}
|
||||
|
||||
static void predictor_decompress_fir_adapt(int32_t *error_buffer,
|
||||
int32_t *buffer_out,
|
||||
int output_size,
|
||||
int readsamplesize,
|
||||
int16_t *predictor_coef_table,
|
||||
int predictor_coef_num,
|
||||
int predictor_quantitization)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* first sample always copies */
|
||||
*buffer_out = *error_buffer;
|
||||
|
||||
if (!predictor_coef_num) {
|
||||
if (output_size <= 1)
|
||||
return;
|
||||
|
||||
memcpy(buffer_out+1, error_buffer+1, (output_size-1) * 4);
|
||||
return;
|
||||
}
|
||||
|
||||
if (predictor_coef_num == 0x1f) { /* 11111 - max value of predictor_coef_num */
|
||||
/* second-best case scenario for fir decompression,
|
||||
* error describes a small difference from the previous sample only
|
||||
*/
|
||||
if (output_size <= 1)
|
||||
return;
|
||||
for (i = 0; i < output_size - 1; i++) {
|
||||
int32_t prev_value;
|
||||
int32_t error_value;
|
||||
|
||||
prev_value = buffer_out[i];
|
||||
error_value = error_buffer[i+1];
|
||||
buffer_out[i+1] =
|
||||
extend_sign32((prev_value + error_value), readsamplesize);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* read warm-up samples */
|
||||
if (predictor_coef_num > 0)
|
||||
for (i = 0; i < predictor_coef_num; i++) {
|
||||
int32_t val;
|
||||
|
||||
val = buffer_out[i] + error_buffer[i+1];
|
||||
val = extend_sign32(val, readsamplesize);
|
||||
buffer_out[i+1] = val;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* 4 and 8 are very common cases (the only ones i've seen). these
|
||||
* should be unrolled and optimized
|
||||
*/
|
||||
if (predictor_coef_num == 4) {
|
||||
/* FIXME: optimized general case */
|
||||
return;
|
||||
}
|
||||
|
||||
if (predictor_coef_table == 8) {
|
||||
/* FIXME: optimized general case */
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* general case */
|
||||
if (predictor_coef_num > 0) {
|
||||
for (i = predictor_coef_num + 1; i < output_size; i++) {
|
||||
int j;
|
||||
int sum = 0;
|
||||
int outval;
|
||||
int error_val = error_buffer[i];
|
||||
|
||||
for (j = 0; j < predictor_coef_num; j++) {
|
||||
sum += (buffer_out[predictor_coef_num-j] - buffer_out[0]) *
|
||||
predictor_coef_table[j];
|
||||
}
|
||||
|
||||
outval = (1 << (predictor_quantitization-1)) + sum;
|
||||
outval = outval >> predictor_quantitization;
|
||||
outval = outval + buffer_out[0] + error_val;
|
||||
outval = extend_sign32(outval, readsamplesize);
|
||||
|
||||
buffer_out[predictor_coef_num+1] = outval;
|
||||
|
||||
if (error_val > 0) {
|
||||
int predictor_num = predictor_coef_num - 1;
|
||||
|
||||
while (predictor_num >= 0 && error_val > 0) {
|
||||
int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
|
||||
int sign = sign_only(val);
|
||||
|
||||
predictor_coef_table[predictor_num] -= sign;
|
||||
|
||||
val *= sign; /* absolute value */
|
||||
|
||||
error_val -= ((val >> predictor_quantitization) *
|
||||
(predictor_coef_num - predictor_num));
|
||||
|
||||
predictor_num--;
|
||||
}
|
||||
} else if (error_val < 0) {
|
||||
int predictor_num = predictor_coef_num - 1;
|
||||
|
||||
while (predictor_num >= 0 && error_val < 0) {
|
||||
int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
|
||||
int sign = - sign_only(val);
|
||||
|
||||
predictor_coef_table[predictor_num] -= sign;
|
||||
|
||||
val *= sign; /* neg value */
|
||||
|
||||
error_val -= ((val >> predictor_quantitization) *
|
||||
(predictor_coef_num - predictor_num));
|
||||
|
||||
predictor_num--;
|
||||
}
|
||||
}
|
||||
|
||||
buffer_out++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void reconstruct_stereo_16(int32_t *buffer[MAX_CHANNELS],
|
||||
int16_t *buffer_out,
|
||||
int numchannels, int numsamples,
|
||||
uint8_t interlacing_shift,
|
||||
uint8_t interlacing_leftweight)
|
||||
{
|
||||
int i;
|
||||
if (numsamples <= 0)
|
||||
return;
|
||||
|
||||
/* weighted interlacing */
|
||||
if (interlacing_leftweight) {
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
int32_t a, b;
|
||||
|
||||
a = buffer[0][i];
|
||||
b = buffer[1][i];
|
||||
|
||||
a -= (b * interlacing_leftweight) >> interlacing_shift;
|
||||
b += a;
|
||||
|
||||
buffer_out[i*numchannels] = b;
|
||||
buffer_out[i*numchannels + 1] = a;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* otherwise basic interlacing took place */
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
int16_t left, right;
|
||||
|
||||
left = buffer[0][i];
|
||||
right = buffer[1][i];
|
||||
|
||||
buffer_out[i*numchannels] = left;
|
||||
buffer_out[i*numchannels + 1] = right;
|
||||
}
|
||||
}
|
||||
|
||||
static int alac_decode_frame(AVCodecContext *avctx,
|
||||
void *outbuffer, int *outputsize,
|
||||
const uint8_t *inbuffer, int input_buffer_size)
|
||||
{
|
||||
ALACContext *alac = avctx->priv_data;
|
||||
|
||||
int channels;
|
||||
unsigned int outputsamples;
|
||||
int hassize;
|
||||
unsigned int readsamplesize;
|
||||
int wasted_bytes;
|
||||
int isnotcompressed;
|
||||
uint8_t interlacing_shift;
|
||||
uint8_t interlacing_leftweight;
|
||||
|
||||
/* short-circuit null buffers */
|
||||
if (!inbuffer || !input_buffer_size)
|
||||
return input_buffer_size;
|
||||
|
||||
/* initialize from the extradata */
|
||||
if (!alac->context_initialized) {
|
||||
if (alac->avctx->extradata_size != ALAC_EXTRADATA_SIZE) {
|
||||
av_log(avctx, AV_LOG_ERROR, "alac: expected %d extradata bytes\n",
|
||||
ALAC_EXTRADATA_SIZE);
|
||||
return input_buffer_size;
|
||||
}
|
||||
if (alac_set_info(alac)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "alac: set_info failed\n");
|
||||
return input_buffer_size;
|
||||
}
|
||||
alac->context_initialized = 1;
|
||||
}
|
||||
|
||||
init_get_bits(&alac->gb, inbuffer, input_buffer_size * 8);
|
||||
|
||||
channels = get_bits(&alac->gb, 3) + 1;
|
||||
if (channels > MAX_CHANNELS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "channels > %d not supported\n",
|
||||
MAX_CHANNELS);
|
||||
return input_buffer_size;
|
||||
}
|
||||
|
||||
/* 2^result = something to do with output waiting.
|
||||
* perhaps matters if we read > 1 frame in a pass?
|
||||
*/
|
||||
skip_bits(&alac->gb, 4);
|
||||
|
||||
skip_bits(&alac->gb, 12); /* unknown, skip 12 bits */
|
||||
|
||||
/* the output sample size is stored soon */
|
||||
hassize = get_bits1(&alac->gb);
|
||||
|
||||
wasted_bytes = get_bits(&alac->gb, 2); /* unknown ? */
|
||||
|
||||
/* whether the frame is compressed */
|
||||
isnotcompressed = get_bits1(&alac->gb);
|
||||
|
||||
if (hassize) {
|
||||
/* now read the number of samples as a 32bit integer */
|
||||
outputsamples = get_bits_long(&alac->gb, 32);
|
||||
if(outputsamples > alac->setinfo_max_samples_per_frame){
|
||||
av_log(avctx, AV_LOG_ERROR, "outputsamples %d > %d\n", outputsamples, alac->setinfo_max_samples_per_frame);
|
||||
return -1;
|
||||
}
|
||||
} else
|
||||
outputsamples = alac->setinfo_max_samples_per_frame;
|
||||
|
||||
if(outputsamples > *outputsize / alac->bytespersample){
|
||||
av_log(avctx, AV_LOG_ERROR, "sample buffer too small\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
*outputsize = outputsamples * alac->bytespersample;
|
||||
readsamplesize = alac->setinfo_sample_size - (wasted_bytes * 8) + channels - 1;
|
||||
if (readsamplesize > MIN_CACHE_BITS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "readsamplesize too big (%d)\n", readsamplesize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!isnotcompressed) {
|
||||
/* so it is compressed */
|
||||
int16_t predictor_coef_table[channels][32];
|
||||
int predictor_coef_num[channels];
|
||||
int prediction_type[channels];
|
||||
int prediction_quantitization[channels];
|
||||
int ricemodifier[channels];
|
||||
int i, chan;
|
||||
|
||||
interlacing_shift = get_bits(&alac->gb, 8);
|
||||
interlacing_leftweight = get_bits(&alac->gb, 8);
|
||||
|
||||
for (chan = 0; chan < channels; chan++) {
|
||||
prediction_type[chan] = get_bits(&alac->gb, 4);
|
||||
prediction_quantitization[chan] = get_bits(&alac->gb, 4);
|
||||
|
||||
ricemodifier[chan] = get_bits(&alac->gb, 3);
|
||||
predictor_coef_num[chan] = get_bits(&alac->gb, 5);
|
||||
|
||||
/* read the predictor table */
|
||||
for (i = 0; i < predictor_coef_num[chan]; i++)
|
||||
predictor_coef_table[chan][i] = (int16_t)get_bits(&alac->gb, 16);
|
||||
}
|
||||
|
||||
if (wasted_bytes)
|
||||
av_log(avctx, AV_LOG_ERROR, "FIXME: unimplemented, unhandling of wasted_bytes\n");
|
||||
|
||||
for (chan = 0; chan < channels; chan++) {
|
||||
bastardized_rice_decompress(alac,
|
||||
alac->predicterror_buffer[chan],
|
||||
outputsamples,
|
||||
readsamplesize,
|
||||
alac->setinfo_rice_initialhistory,
|
||||
alac->setinfo_rice_kmodifier,
|
||||
ricemodifier[chan] * alac->setinfo_rice_historymult / 4,
|
||||
(1 << alac->setinfo_rice_kmodifier) - 1);
|
||||
|
||||
if (prediction_type[chan] == 0) {
|
||||
/* adaptive fir */
|
||||
predictor_decompress_fir_adapt(alac->predicterror_buffer[chan],
|
||||
alac->outputsamples_buffer[chan],
|
||||
outputsamples,
|
||||
readsamplesize,
|
||||
predictor_coef_table[chan],
|
||||
predictor_coef_num[chan],
|
||||
prediction_quantitization[chan]);
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type[chan]);
|
||||
/* I think the only other prediction type (or perhaps this is
|
||||
* just a boolean?) runs adaptive fir twice.. like:
|
||||
* predictor_decompress_fir_adapt(predictor_error, tempout, ...)
|
||||
* predictor_decompress_fir_adapt(predictor_error, outputsamples ...)
|
||||
* little strange..
|
||||
*/
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* not compressed, easy case */
|
||||
int i, chan;
|
||||
for (i = 0; i < outputsamples; i++)
|
||||
for (chan = 0; chan < channels; chan++) {
|
||||
int32_t audiobits;
|
||||
|
||||
audiobits = get_bits_long(&alac->gb, alac->setinfo_sample_size);
|
||||
audiobits = extend_sign32(audiobits, alac->setinfo_sample_size);
|
||||
|
||||
alac->outputsamples_buffer[chan][i] = audiobits;
|
||||
}
|
||||
/* wasted_bytes = 0; */
|
||||
interlacing_shift = 0;
|
||||
interlacing_leftweight = 0;
|
||||
}
|
||||
if (get_bits(&alac->gb, 3) != 7)
|
||||
av_log(avctx, AV_LOG_ERROR, "Error : Wrong End Of Frame\n");
|
||||
|
||||
switch(alac->setinfo_sample_size) {
|
||||
case 16:
|
||||
if (channels == 2) {
|
||||
reconstruct_stereo_16(alac->outputsamples_buffer,
|
||||
(int16_t*)outbuffer,
|
||||
alac->numchannels,
|
||||
outputsamples,
|
||||
interlacing_shift,
|
||||
interlacing_leftweight);
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < outputsamples; i++) {
|
||||
int16_t sample = alac->outputsamples_buffer[0][i];
|
||||
((int16_t*)outbuffer)[i * alac->numchannels] = sample;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 20:
|
||||
case 24:
|
||||
// It is not clear if there exist any encoder that creates 24 bit ALAC
|
||||
// files. iTunes convert 24 bit raw files to 16 bit before encoding.
|
||||
case 32:
|
||||
av_log(avctx, AV_LOG_ERROR, "FIXME: unimplemented sample size %i\n", alac->setinfo_sample_size);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (input_buffer_size * 8 - get_bits_count(&alac->gb) > 8)
|
||||
av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n", input_buffer_size * 8 - get_bits_count(&alac->gb));
|
||||
|
||||
return input_buffer_size;
|
||||
}
|
||||
|
||||
static av_cold int alac_decode_init(AVCodecContext * avctx)
|
||||
{
|
||||
ALACContext *alac = avctx->priv_data;
|
||||
alac->avctx = avctx;
|
||||
alac->context_initialized = 0;
|
||||
|
||||
alac->numchannels = alac->avctx->channels;
|
||||
alac->bytespersample = 2 * alac->numchannels;
|
||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static av_cold int alac_decode_close(AVCodecContext *avctx)
|
||||
{
|
||||
ALACContext *alac = avctx->priv_data;
|
||||
|
||||
int chan;
|
||||
for (chan = 0; chan < MAX_CHANNELS; chan++) {
|
||||
av_free(alac->predicterror_buffer[chan]);
|
||||
av_free(alac->outputsamples_buffer[chan]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVCodec alac_decoder = {
|
||||
"alac",
|
||||
CODEC_TYPE_AUDIO,
|
||||
CODEC_ID_ALAC,
|
||||
sizeof(ALACContext),
|
||||
alac_decode_init,
|
||||
NULL,
|
||||
alac_decode_close,
|
||||
alac_decode_frame,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user