Compare commits
59 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 140fd653ae | |||
| 09f15530e5 | |||
| af310e68db | |||
| c3747e011e | |||
| f258c9a8e5 | |||
| a6c578ef65 | |||
| efa64c2acc | |||
| 9c5f654e44 | |||
| 5494973d28 | |||
| 15cb74fc68 | |||
| 9ddd245b09 | |||
| c1a7f4040a | |||
| 17f4cc0992 | |||
| eeff85f15d | |||
| bc88c1d62e | |||
| 3b8fe34a30 | |||
| ac8cbf2ad7 | |||
| 30b308f7a8 | |||
| afc8c20946 | |||
| debbeb006b | |||
| 8c117d7fec | |||
| 5f8cb575e8 | |||
| abf123b744 | |||
| e97babf6bc | |||
| 9bc89a2605 | |||
| ac5ff0ae89 | |||
| a2e445918e | |||
| 34c39367aa | |||
| 3cab009519 | |||
| 3e05b89590 | |||
| 4a3e5ea8d2 | |||
| 263e819aa4 | |||
| 23655160ea | |||
| f2507dba3b | |||
| da3f5273fc | |||
| 6049800a10 | |||
| e726f7af17 | |||
| de76fb27a6 | |||
| 995d329cf9 | |||
| 81dcb67813 | |||
| bde02336a4 | |||
| 6b1f994e43 | |||
| 5051753833 | |||
| a676267a2c | |||
| bd55bf8300 | |||
| 64c71cbe4e | |||
| 2feaad5cb9 | |||
| 048f6f4bd5 | |||
| 4558ad6a77 | |||
| 937d9ed849 | |||
| 13b161cd24 | |||
| 7c92f740ee | |||
| 057b94649f | |||
| 26da3d0069 | |||
| a8fdfddedb | |||
| 89849ca92a | |||
| 370cff8b33 | |||
| 9fd3869212 | |||
| 0a167141d0 |
+7
-152
@@ -12,168 +12,45 @@
|
||||
# =======
|
||||
libavcodec/.*aac.* @lynne
|
||||
libavcodec/.*ac3.* @lynne
|
||||
libavcodec/.*adpcm.* @zane @pross
|
||||
libavcodec/anm.* @pross
|
||||
libavcodec/amf.* @OvchinnikovDmitrii @ArazIusubov
|
||||
libavcodec/ansi.* @pross
|
||||
libavcodec/aom_film_grain.* @haasn
|
||||
libavcodec/.*atrac9.* @lynne
|
||||
libavcodec/bink.* @pross
|
||||
libavcodec/bintext.* @pross
|
||||
libavcodec/.*bitpacked.* @lynne
|
||||
libavcodec/.*d3d12va.* @jianhuaw @tong1wu @younengxiao
|
||||
libavcodec/.*d3d12va.* @jianhuaw
|
||||
libavcodec/.*dirac.* @lynne
|
||||
libavcodec/.*dovi_rpu.* @haasn
|
||||
libavcodec/dpx.* @pross
|
||||
libavcodec/dsd.* @pross
|
||||
libavcodec/eacmv.* @pross
|
||||
libavcodec/eaidct.* @pross
|
||||
libavcodec/eamad.* @pross
|
||||
libavcodec/eat.* @pross
|
||||
libavcodec/.*exif.* @Traneptora
|
||||
libavcodec/.*ffv1.* @lynne @michaelni
|
||||
libavcodec/g728.* @pross
|
||||
libavcodec/gem.* @pross
|
||||
libavcodec/golomb.* @michaelni
|
||||
libavcodec/.*h266.* @frankplow @NuoMi @jianhuaw
|
||||
libavcodec/h26x/.* @frankplow @NuoMi @jianhuaw
|
||||
libavcodec/.*h274.* @haasn
|
||||
libavcodec/iff.* @pross
|
||||
libavcodec/.*jpegxl.* @lynne @Traneptora
|
||||
libavcodec/jpeg2000htdec.* @cae
|
||||
libavcodec/jv.* @pross
|
||||
libavcodec/.*jxl.* @lynne @Traneptora
|
||||
libavcodec/.*lcms2.* @haasn
|
||||
libavcodec/lead.* @pross
|
||||
libavcodec/mediacodec* @quink
|
||||
libavcodec/mjpeg* @michaelni
|
||||
libavcodec/mmvideo.* @pross
|
||||
libavcodec/msp2.* @pross
|
||||
libavcodec/mvc.* @pross
|
||||
libavcodec/oh* @quink
|
||||
libavcodec/.*jpegxl.* @lynne
|
||||
libavcodec/.*jxl.* @lynne
|
||||
libavcodec/.*opus.* @lynne
|
||||
libavcodec/pictor.* @pross
|
||||
libavcodec/.*png.* @Traneptora
|
||||
libavcodec/.*prores.* @lynne
|
||||
libavcodec/rangecoder.* @michaelni
|
||||
libavcodec/ratecontrol.* @michaelni
|
||||
libavcodec/rv60.* @pross
|
||||
libavcodec/sgirle.* @pross
|
||||
libavcodec/.*siren.* @lynne
|
||||
libavcodec/smpte_436m.* @programmerjake
|
||||
libavcodec/svq1.* @pross
|
||||
libavcodec/svq3.* @pross
|
||||
libavcodec/.*vc2.* @lynne
|
||||
libavcodec/videotoolbox.* @ePirat
|
||||
libavcodec/vp3.* @pross
|
||||
libavcodec/vp4.* @pross
|
||||
libavcodec/vp5.* @pross
|
||||
libavcodec/vp6.* @pross
|
||||
libavcodec/vp8.* @rbultje @pross
|
||||
libavcodec/vp9.* @rbultje
|
||||
libavcodec/vpx.* @rbultje @pross
|
||||
libavcodec/vqc.* @pross
|
||||
libavcodec/.*vvc.* @frankplow @NuoMi @jianhuaw
|
||||
libavcodec/wmavoice.* @rbultje
|
||||
libavcodec/wbmp.* @pross
|
||||
|
||||
# bitstream filters
|
||||
libavcodec/bsf/eia608_to_smpte436m.* @programmerjake
|
||||
libavcodec/bsf/smpte436m_to_eia608.* @programmerjake
|
||||
|
||||
# architecture-specific
|
||||
libavcodec/aarch64/.* @lynne @mstorsjo
|
||||
libavcodec/arm/.* @mstorsjo
|
||||
libavcodec/ppc/.* @sean_mcg
|
||||
libavcodec/riscv/.* @Courmisch
|
||||
libavcodec/wasm/hevc/.* @quink
|
||||
libavcodec/x86/.* @lynne
|
||||
libavcodec/x86/vp8.* @rbultje
|
||||
libavcodec/x86/vp9.* @rbultje
|
||||
libavcodec/x86/vpx.* @rbultje
|
||||
|
||||
# avfilter
|
||||
# =======
|
||||
libavfilter/af_loudnorm.* @kylophone
|
||||
libavfilter/aarch64/.* @mstorsjo
|
||||
libavfilter/af_whisper.* @vpalmisano
|
||||
libavfilter/.*_amf* @OvchinnikovDmitrii @ArazIusubov
|
||||
libavfilter/avfiltergraph.* @haasn
|
||||
libavfilter/colorspace.* @rbultje
|
||||
libavfilter/formats.* @haasn
|
||||
libavfilter/.*f_ebur128.* @haasn
|
||||
libavfilter/vf_blackdetect.* @haasn
|
||||
libavfilter/vf_colordetect.* @haasn
|
||||
libavfilter/vf_colorspace.* @rbultje
|
||||
libavfilter/.*drawvg.* @ayosec
|
||||
libavfilter/vf_find_rect.* @michaelni
|
||||
libavfilter/vf_icc.* @haasn
|
||||
libavfilter/vf_libplacebo.* @haasn
|
||||
libavfilter/vf_libvmaf.* @kylophone
|
||||
libavfilter/vf_premultiply.* @haasn
|
||||
libavfilter/vf_scale.* @haasn
|
||||
libavfilter/vf_scale_vt.* @quink
|
||||
libavfilter/vf_thumbnail.* @haasn
|
||||
libavfilter/vf_transpose_vt.* @quink
|
||||
libavfilter/vf_yadif.* @michaelni
|
||||
libavfilter/vsrc_mandelbrot.* @michaelni
|
||||
|
||||
libavfilter/aarch64/.* @mstorsjo
|
||||
libavfilter/riscv/.* @Courmisch
|
||||
libavfilter/x86/colorspace.* @rbultje
|
||||
libavfilter/x86/scene_sad.* @haasn
|
||||
|
||||
# avformat
|
||||
# =======
|
||||
libavformat/alp.* @zane
|
||||
libavformat/amv.* @zane
|
||||
libavformat/anm.* @pross
|
||||
libavformat/apm.* @zane
|
||||
libavformat/argo_.* @zane
|
||||
libavformat/bink.* @pross
|
||||
libavformat/bintext.* @pross
|
||||
libavformat/caf.* @pross
|
||||
libavformat/cine.* @pross
|
||||
libavformat/dsf.* @pross
|
||||
libavformat/eacdata.* @pross
|
||||
libavformat/electronicarts.* @pross
|
||||
libavformat/.*exif.* @Traneptora
|
||||
libavformat/filmstrip.* @pross
|
||||
libavformat/frm.* @pross
|
||||
libavformat/iamf.* @jamrial
|
||||
libavformat/icecast.c @ePirat
|
||||
libavformat/ico.* @pross
|
||||
libavformat/iff.* @pross
|
||||
libavformat/.*jpegxl.* @Traneptora
|
||||
libavformat/jv.* @pross
|
||||
libavformat/.*jxl.* @Traneptora
|
||||
libavformat/kvag.* @zane
|
||||
libavformat/mccdec.* @programmerjake
|
||||
libavformat/mccenc.* @programmerjake
|
||||
libavformat/mlv.* @pross
|
||||
libavformat/mm.* @pross
|
||||
libavformat/msp.* @pross
|
||||
libavformat/mv.* @pross
|
||||
libavformat/pp_bnk.* @zane
|
||||
libavformat/rm.* @pross
|
||||
libavformat/sauce.* @pross
|
||||
libavformat/scd.* @zane
|
||||
libavformat/tty.* @pross
|
||||
libavformat/whip.c @JackLau
|
||||
libavformat/wsd.* @pross
|
||||
libavformat/wtv.* @pross
|
||||
|
||||
# avutil
|
||||
# ======
|
||||
libavutil/.*_amf* @OvchinnikovDmitrii @ArazIusubov
|
||||
libavutil/.*crc.* @lynne @michaelni
|
||||
libavutil/.*d3d12va.* @jianhuaw @tong1wu @younengxiao
|
||||
libavutil/csp.* @rbultje @haasn
|
||||
libavutil/.*d3d12va.* @jianhuaw
|
||||
libavutil/eval.* @michaelni
|
||||
libavutil/film_grain.* @haasn
|
||||
libavutil/dovi_meta.* @haasn
|
||||
libavutil/hwcontext_oh.* @quink
|
||||
libavutil/hwcontext_mediacodec.* @quink
|
||||
libavutil/hwcontext_videotoolbox.* @ePirat
|
||||
libavutil/iamf.* @jamrial
|
||||
libavutil/integer.* @michaelni
|
||||
libavutil/lfg.* @michaelni
|
||||
@@ -192,7 +69,6 @@ libavutil/tx.* @lynne
|
||||
libavutil/aarch64/.* @lynne @mstorsjo
|
||||
libavutil/arm/.* @mstorsjo
|
||||
libavutil/ppc/.* @sean_mcg
|
||||
libavutil/riscv/.* @Courmisch
|
||||
libavutil/x86/.* @lynne
|
||||
|
||||
# swresample
|
||||
@@ -206,13 +82,6 @@ libswresample/.* @michaelni
|
||||
libswscale/aarch64/.* @mstorsjo
|
||||
libswscale/arm/.* @mstorsjo
|
||||
libswscale/ppc/.* @sean_mcg
|
||||
libswscale/riscv/.* @Courmisch
|
||||
libswscale/.* @haasn
|
||||
|
||||
# tools
|
||||
# =====
|
||||
fftools/ffplay_renderer.* @haasn
|
||||
tools/target_dec_fuzzer.c @michaelni
|
||||
|
||||
# doc
|
||||
# ===
|
||||
@@ -220,19 +89,5 @@ doc/.* @GyanD
|
||||
|
||||
# Frameworks
|
||||
# ==========
|
||||
.*d3d12va.* @jianhuaw @tong1wu @younengxiao
|
||||
.*vulkan.* @lynne @haasn
|
||||
|
||||
# tests
|
||||
# =====
|
||||
tests/checkasm/riscv/.* @Courmisch
|
||||
tests/ref/.*drawvg.* @ayosec
|
||||
tests/ref/fate/sub-mcc.* @programmerjake
|
||||
|
||||
# Forgejo
|
||||
# =======
|
||||
.forgejo/CODEOWNERS @michaelni
|
||||
|
||||
# /
|
||||
# =
|
||||
MAINTAINERS @michaelni
|
||||
.*d3d12va.* @jianhuaw
|
||||
.*vulkan.* @lynne
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
module.exports = async ({github, context}) => {
|
||||
const title = (context.payload.pull_request?.title || context.payload.issue?.title || '').toLowerCase();
|
||||
const labels = [];
|
||||
const issueNumber = context.payload.pull_request?.number || context.payload.issue?.number;
|
||||
|
||||
const kwmap = {
|
||||
'avcodec': 'avcodec',
|
||||
@@ -11,55 +10,18 @@ module.exports = async ({github, context}) => {
|
||||
'avutil': 'avutil',
|
||||
'swresample': 'swresample',
|
||||
'swscale': 'swscale',
|
||||
'fftools': 'CLI',
|
||||
'vulkan': 'vulkan'
|
||||
'fftools': 'CLI'
|
||||
};
|
||||
|
||||
async function isOrgMember(username) {
|
||||
try {
|
||||
const response = await github.rest.orgs.checkMembershipForUser({
|
||||
org: context.repo.owner,
|
||||
username: username
|
||||
});
|
||||
return response.status === 204;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (context.payload.action === 'closed' ||
|
||||
(context.payload.action !== 'opened' && (
|
||||
context.payload.action === 'assigned' ||
|
||||
context.payload.action === 'label_updated' ||
|
||||
context.payload.action === 'labeled' ||
|
||||
context.payload.comment) &&
|
||||
await isOrgMember(context.payload.sender.login))
|
||||
) {
|
||||
try {
|
||||
await github.rest.issues.removeLabel({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issueNumber,
|
||||
// this should say 'new', but forgejo deviates from GitHub API here and expects the ID
|
||||
name: '41'
|
||||
});
|
||||
console.log('Removed "new" label');
|
||||
} catch (error) {
|
||||
if (error.status !== 404 && error.status !== 410) {
|
||||
console.log('Could not remove "new" label');
|
||||
}
|
||||
}
|
||||
} else if (context.payload.action === 'opened') {
|
||||
if (context.payload.action === 'opened') {
|
||||
labels.push('new');
|
||||
console.log('Detected label: new');
|
||||
}
|
||||
|
||||
if ((context.payload.action === 'opened' || context.payload.action === 'edited') && context.eventName !== 'issue_comment') {
|
||||
for (const [kw, label] of Object.entries(kwmap)) {
|
||||
if (title.includes(kw)) {
|
||||
labels.push(label);
|
||||
console.log('Detected label: ' + label);
|
||||
}
|
||||
for (const [kw, label] of Object.entries(kwmap)) {
|
||||
if (title.includes(kw)) {
|
||||
labels.push(label);
|
||||
console.log('Detected label: ' + label);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +29,7 @@ module.exports = async ({github, context}) => {
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issueNumber,
|
||||
issue_number: context.payload.pull_request?.number || context.payload.issue?.number,
|
||||
labels: labels,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,35 +1,31 @@
|
||||
avcodec:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'libavcodec/**'
|
||||
- any-glob-to-any-file: libavcodec/**
|
||||
|
||||
avdevice:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'libavdevice/**'
|
||||
- any-glob-to-any-file: libavdevice/**
|
||||
|
||||
avfilter:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'libavfilter/**'
|
||||
- any-glob-to-any-file: libavfilter/**
|
||||
|
||||
avformat:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'libavformat/**'
|
||||
- any-glob-to-any-file: libavformat/**
|
||||
|
||||
avutil:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'libavutil/**'
|
||||
- any-glob-to-any-file: libavutil/**
|
||||
|
||||
swresample:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'libswresample/**'
|
||||
- any-glob-to-any-file: libswresample/**
|
||||
|
||||
swscale:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'libswscale/**'
|
||||
- any-glob-to-any-file: libswscale/**
|
||||
|
||||
CLI:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'fftools/**'
|
||||
|
||||
vulkan:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: '**/*vulkan*'
|
||||
- any-glob-to-any-file: fftools/**
|
||||
|
||||
@@ -18,14 +18,6 @@ repos:
|
||||
- id: fix-byte-order-marker
|
||||
- id: mixed-line-ending
|
||||
- id: trailing-whitespace
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: aarch64-asm-indent
|
||||
name: fix aarch64 assembly indentation
|
||||
files: ^.*/aarch64/.*\.S$
|
||||
language: script
|
||||
entry: ./tools/check_arm_indent.sh --apply
|
||||
pass_filenames: false
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.4.1
|
||||
hooks:
|
||||
|
||||
@@ -1,29 +1,23 @@
|
||||
name: Autolabel
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, edited, synchronize, closed, assigned, labeled, unlabeled]
|
||||
types: [opened, edited, synchronize]
|
||||
issues:
|
||||
types: [opened, edited, closed, assigned, labeled, unlabeled]
|
||||
issue_comment:
|
||||
types: [created]
|
||||
types: [opened, edited]
|
||||
|
||||
jobs:
|
||||
pr_labeler:
|
||||
name: Labeler
|
||||
runs-on: utilities
|
||||
if: ${{ github.event.sender.login != 'ffmpeg-devel' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
- name: Label by file-changes
|
||||
uses: actions/labeler@v6
|
||||
uses: https://github.com/actions/labeler@v5
|
||||
if: ${{ forge.event_name == 'pull_request_target' }}
|
||||
with:
|
||||
configuration-path: .forgejo/labeler/labeler.yml
|
||||
repo-token: ${{ secrets.AUTOLABELER_TOKEN }}
|
||||
- name: Label by title-match
|
||||
uses: actions/github-script@v8
|
||||
uses: https://github.com/actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const script = require('.forgejo/labeler/labeler.js')
|
||||
|
||||
@@ -1,21 +1,15 @@
|
||||
name: Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
cancel-in-progress: ${{ forge.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Pre-Commit
|
||||
runs-on: utilities
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
- name: Install pre-commit CI
|
||||
id: install
|
||||
run: |
|
||||
@@ -24,7 +18,7 @@ jobs:
|
||||
~/pre-commit/bin/pip install pre-commit
|
||||
echo "envhash=$({ python3 --version && cat .forgejo/pre-commit/config.yaml; } | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
|
||||
- name: Cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pre-commit
|
||||
key: pre-commit-${{ steps.install.outputs.envhash }}
|
||||
|
||||
+11
-70
@@ -1,47 +1,26 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
cancel-in-progress: ${{ forge.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
run_fate:
|
||||
name: Fate (${{ matrix.runner }}, ${{ matrix.shared }}, ${{ matrix.bits }} bit)
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runner: [linux-aarch64]
|
||||
shared: ['static']
|
||||
bits: ['64']
|
||||
include:
|
||||
- runner: linux-amd64
|
||||
shared: 'static'
|
||||
bits: '32'
|
||||
- runner: linux-amd64
|
||||
shared: 'shared'
|
||||
bits: '64'
|
||||
runner: [linux-amd64,linux-aarch64]
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
- name: Configure
|
||||
run: |
|
||||
./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2 \
|
||||
$([ "${{ matrix.bits }}" != "32" ] || echo --arch=x86_32 --extra-cflags=-m32 --extra-cxxflags=-m32 --extra-ldflags=-m32) \
|
||||
$([ "${{ matrix.shared }}" != "shared" ] || echo --enable-shared --disable-static) \
|
||||
|| CFGRES=$?
|
||||
cat ffbuild/config.log
|
||||
exit ${CFGRES:-0}
|
||||
run: ./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2
|
||||
- name: Build
|
||||
run: make -j$(nproc)
|
||||
- name: Restore Cached Fate-Suite
|
||||
id: cache
|
||||
uses: actions/cache/restore@v5
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: fate-suite
|
||||
key: fate-suite
|
||||
@@ -51,68 +30,30 @@ jobs:
|
||||
id: fate
|
||||
run: |
|
||||
make fate-rsync SAMPLES=$PWD/fate-suite
|
||||
echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | sort | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
|
||||
echo "hash=$(find fate-suite -type f | sort | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
|
||||
- name: Cache Fate-Suite
|
||||
uses: actions/cache/save@v5
|
||||
uses: actions/cache/save@v4
|
||||
if: ${{ format('fate-suite-{0}', steps.fate.outputs.hash) != steps.cache.outputs.cache-matched-key }}
|
||||
with:
|
||||
path: fate-suite
|
||||
key: fate-suite-${{ steps.fate.outputs.hash }}
|
||||
- name: Run Fate
|
||||
run: |
|
||||
LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make fate fate-build SAMPLES="$PWD/fate-suite" -j$(nproc) || FATERES=$?
|
||||
find . -name "*.err" -exec printf '::group::%s\n' {} \; -exec cat {} \; -exec printf '::endgroup::\n' \;
|
||||
exit ${FATERES:-0}
|
||||
run_fate_full:
|
||||
name: Fate (Full, ${{ matrix.target_exec }})
|
||||
run: make fate SAMPLES=$PWD/fate-suite -j$(nproc)
|
||||
compile_only:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image: ['ghcr.io/btbn/ffmpeg-builds/win64-gpl:latest']
|
||||
target_exec: ['wine']
|
||||
image: ["ghcr.io/btbn/ffmpeg-builds/win64-gpl:latest"]
|
||||
runs-on: linux-amd64
|
||||
container: ${{ matrix.image }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
- name: Configure
|
||||
run: |
|
||||
./configure --pkg-config-flags="--static" $FFBUILD_TARGET_FLAGS $FF_CONFIGURE \
|
||||
--cc="$CC" --cxx="$CXX" --ar="$AR" --ranlib="$RANLIB" --nm="$NM" \
|
||||
--extra-cflags="$FF_CFLAGS" --extra-cxxflags="$FF_CXXFLAGS" \
|
||||
--extra-libs="$FF_LIBS" --extra-ldflags="$FF_LDFLAGS" --extra-ldexeflags="$FF_LDEXEFLAGS" \
|
||||
--enable-memory-poisoning --assert-level=2 --target-exec="${{ matrix.target_exec }}" \
|
||||
--enable-hardcoded-tables \
|
||||
|| CFGRES=$?
|
||||
cat ffbuild/config.log
|
||||
exit ${CFGRES:-0}
|
||||
--extra-libs="$FF_LIBS" --extra-ldflags="$FF_LDFLAGS" --extra-ldexeflags="$FF_LDEXEFLAGS"
|
||||
- name: Build
|
||||
run: make -j$(nproc)
|
||||
- name: Restore Cached Fate-Suite
|
||||
id: cache
|
||||
uses: actions/cache/restore@v5
|
||||
with:
|
||||
path: fate-suite
|
||||
key: fate-suite
|
||||
restore-keys: |
|
||||
fate-suite-
|
||||
- name: Sync Fate-Suite
|
||||
id: fate
|
||||
run: |
|
||||
make fate-rsync SAMPLES=$PWD/fate-suite
|
||||
echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | sort | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
|
||||
- name: Cache Fate-Suite
|
||||
uses: actions/cache/save@v5
|
||||
if: ${{ format('fate-suite-{0}', steps.fate.outputs.hash) != steps.cache.outputs.cache-matched-key }}
|
||||
with:
|
||||
path: fate-suite
|
||||
key: fate-suite-${{ steps.fate.outputs.hash }}
|
||||
- name: Run Fate
|
||||
run: |
|
||||
if [[ "${{ matrix.target_exec }}" == "wine" ]]; then
|
||||
export WINEDEBUG=-all
|
||||
export FREI0R_PATH="$(winepath -w "$FREI0R_PATH")"
|
||||
fi
|
||||
LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make fate fate-build SAMPLES="$PWD/fate-suite" -j$(nproc) || FATERES=$?
|
||||
find . -name "*.err" -exec printf '::group::%s\n' {} \; -exec cat {} \; -exec printf '::endgroup::\n' \;
|
||||
exit ${FATERES:-0}
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
*.metal.air
|
||||
*.metallib
|
||||
*.metallib.c
|
||||
*.spv
|
||||
*.spv.c
|
||||
*.spv.gz
|
||||
*.ptx
|
||||
*.ptx.c
|
||||
*.ptx.gz
|
||||
@@ -39,7 +36,6 @@
|
||||
/ffprobe
|
||||
/config.asm
|
||||
/config.h
|
||||
/config_components.asm
|
||||
/config_components.h
|
||||
/coverage.info
|
||||
/lcov/
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Note to Github users
|
||||
Patches should be submitted to [Forgejo](https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls) or the [ffmpeg-devel mailing list](https://ffmpeg.org/mailman/listinfo/ffmpeg-devel) using `git format-patch` or `git send-email`. Github pull requests should be avoided because they are not part of our review process and **will be ignored**.
|
||||
Patches should be submitted to the [ffmpeg-devel mailing list](https://ffmpeg.org/mailman/listinfo/ffmpeg-devel) using `git format-patch` or `git send-email`. Github pull requests should be avoided because they are not part of our review process and **will be ignored**.
|
||||
|
||||
See [https://ffmpeg.org/developer.html#Contributing](https://ffmpeg.org/developer.html#Contributing) for more information.
|
||||
|
||||
@@ -1,45 +1,11 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
|
||||
|
||||
version 8.1:
|
||||
- ffprobe -codec option
|
||||
- EXIF Metadata Parsing
|
||||
- gfxcapture: Windows.Graphics.Capture based window/monitor capture
|
||||
- hxvs demuxer for HXVS/HXVT IP camera format
|
||||
- MPEG-H 3D Audio decoding via mpeghdec
|
||||
- D3D12 H.264 encoder
|
||||
- drawvg filter via libcairo
|
||||
- ffmpeg CLI tiled HEIF support
|
||||
- D3D12 AV1 encoder
|
||||
- ProRes Vulkan hwaccel
|
||||
- DPX Vulkan hwaccel
|
||||
- Rockchip H.264/HEVC hardware encoder
|
||||
- Add vf_scale_d3d12 filter
|
||||
- JPEG-XS parser
|
||||
- JPEG-XS decoder and encoder through libsvtjpegxs
|
||||
- JPEG-XS raw bitstream muxer and demuxer
|
||||
- IAMF Projection mode Ambisonic Audio Elements muxing and demuxing
|
||||
- Add vf_mestimate_d3d12 filter
|
||||
- xHE-AAC Mps212 decoding support (experimental)
|
||||
- Remove the old HLS protocol handler
|
||||
- Vulkan compute codec optimizations
|
||||
- swscale Vulkan support
|
||||
- LCEVC metadata bitstream filter
|
||||
- Add vf_deinterlace_d3d12 filter
|
||||
- ffprobe: only show refs field in stream section when reading frames
|
||||
- ProRes Vulkan encoder
|
||||
- LCEVC parser
|
||||
- LCEVC enhancement layer exporting in MPEG-TS
|
||||
|
||||
|
||||
version 8.0:
|
||||
- Whisper filter
|
||||
- Drop support for OpenSSL < 1.1.0
|
||||
- Enable TLS peer certificate verification by default (on next major version bump)
|
||||
- Drop support for OpenSSL < 1.1.1
|
||||
- yasm support dropped, users need to use nasm
|
||||
- VVC VAAPI decoder
|
||||
- RealVideo 6.0 decoder
|
||||
@@ -68,8 +34,6 @@ version 8.0:
|
||||
- AV1 Vulkan encoder
|
||||
- ProRes RAW decoder
|
||||
- ProRes RAW Vulkan hwaccel
|
||||
- ffprobe -codec option
|
||||
- HDR10+ metadata passthrough when decoding/encoding with libaom-av1
|
||||
|
||||
|
||||
version 7.1:
|
||||
|
||||
+3
-6
@@ -152,7 +152,7 @@ Codecs:
|
||||
adpcm.c Zane van Iperen
|
||||
alacenc.c Jaikrishnan Menon
|
||||
alsdec.c Thilo Borgmann, Umair Khan
|
||||
amfdec*,amfenc* [2] Dmitrii Ovchinnikov, Araz Iusubov
|
||||
amfenc* Dmitrii Ovchinnikov
|
||||
aptx.c Aurelien Jacobs
|
||||
ass* Aurelien Jacobs
|
||||
asv* Michael Niedermayer
|
||||
@@ -211,7 +211,7 @@ Codecs:
|
||||
libkvazaar.c Arttu Ylä-Outinen
|
||||
libopenh264enc.c Martin Storsjo, Linjie Fu
|
||||
libopenjpegenc.c Michael Bradshaw
|
||||
libtheoraenc.c [0]
|
||||
libtheoraenc.c David Conrad
|
||||
libvorbis.c David Conrad
|
||||
libvpx* James Zern
|
||||
libxavs.c Stefan Gehrer
|
||||
@@ -278,7 +278,6 @@ Codecs:
|
||||
xface Stefano Sabatini
|
||||
|
||||
Hardware acceleration:
|
||||
amf* [2] Dmitrii Ovchinnikov, Araz Iusubov
|
||||
dxva2* Hendrik Leppkes, Laurent Aimar, Steve Lhomme
|
||||
d3d11va* Steve Lhomme
|
||||
d3d12va* Wu Jianhua
|
||||
@@ -483,7 +482,6 @@ Muxers/Demuxers:
|
||||
webm dash (matroskaenc.c) Vignesh Venkatasubramanian
|
||||
webvtt* Matthew J Heaney
|
||||
westwood.c Mike Melanson
|
||||
whip.c [2] Jack Lau
|
||||
wtv.c Peter Ross
|
||||
|
||||
Protocols:
|
||||
@@ -523,7 +521,7 @@ LoongArch [2] Shiyou Yin
|
||||
Darwin (macOS, iOS) [2] Marvin Scholz
|
||||
Mac OS X / PowerPC [0]
|
||||
Amiga / PowerPC Colin Ward
|
||||
Linux / PowerPC [2] Sean McGovern (CC <gseanmcg@gmail.com>), Lauri Kasanen
|
||||
Linux / PowerPC [1] Lauri Kasanen
|
||||
RISC-V [2] Rémi Denis-Courmont
|
||||
Windows MinGW Alex Beregszaszi, Ramiro Polla
|
||||
Windows Cygwin Victor Paesa
|
||||
@@ -619,7 +617,6 @@ 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
|
||||
Robert Swain EE7A 56EA 4A81 A7B5 2001 A521 67FA 362D A2FC 3E71
|
||||
Sascha Sommer 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C
|
||||
Sean McGovern (Sean_McG) 6D03 BC60 3A33 E615 6E2E 06AD 8C06 8175 6F59 8684
|
||||
Stefano Sabatini 0D0B AD6B 5330 BBAD D3D6 6A0C 719C 2839 FC43 2D5F
|
||||
Steinar H. Gunderson C2E9 004F F028 C18E 4EAD DB83 7F61 7561 7797 8F76
|
||||
Stephan Hilb 4F38 0B3A 5F39 B99B F505 E562 8D5C 5554 4E17 8863
|
||||
|
||||
@@ -11,8 +11,6 @@ vpath %.asm $(SRC_PATH)
|
||||
vpath %.rc $(SRC_PATH)
|
||||
vpath %.v $(SRC_PATH)
|
||||
vpath %.texi $(SRC_PATH)
|
||||
vpath %.glsl $(SRC_PATH)
|
||||
vpath %.spv $(SRC_PATH)
|
||||
vpath %.cu $(SRC_PATH)
|
||||
vpath %.ptx $(SRC_PATH)
|
||||
vpath %.metal $(SRC_PATH)
|
||||
@@ -55,31 +53,31 @@ FF_DEP_LIBS := $(DEP_LIBS)
|
||||
FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
|
||||
|
||||
$(TOOLS): %$(EXESUF): %.o
|
||||
$(call LINK,$(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(filter-out $(FF_DEP_LIBS), $^) $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS))
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(filter-out $(FF_DEP_LIBS), $^) $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS)
|
||||
|
||||
target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS)
|
||||
$(call LINK,$(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH))
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
||||
|
||||
target_enc_%_fuzzer$(EXESUF): target_enc_%_fuzzer.o $(FF_DEP_LIBS)
|
||||
$(call LINK,$(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH))
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
||||
|
||||
tools/target_bsf_%_fuzzer$(EXESUF): tools/target_bsf_%_fuzzer.o $(FF_DEP_LIBS)
|
||||
$(call LINK,$(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH))
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
||||
|
||||
target_dem_%_fuzzer$(EXESUF): target_dem_%_fuzzer.o $(FF_DEP_LIBS)
|
||||
$(call LINK,$(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH))
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
||||
|
||||
tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS)
|
||||
$(call LINK,$(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH))
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
||||
|
||||
tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS)
|
||||
$(call LINK,$(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH))
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
||||
|
||||
tools/target_sws_fuzzer$(EXESUF): tools/target_sws_fuzzer.o $(FF_DEP_LIBS)
|
||||
$(call LINK,$(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH))
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
||||
|
||||
tools/target_swr_fuzzer$(EXESUF): tools/target_swr_fuzzer.o $(FF_DEP_LIBS)
|
||||
$(call LINK,$(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH))
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
||||
|
||||
tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
||||
tools/enum_options$(EXESUF): $(FF_DEP_LIBS)
|
||||
@@ -109,11 +107,10 @@ ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
|
||||
SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
|
||||
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
|
||||
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
|
||||
ALTIVEC-OBJS VSX-OBJS X86ASM-OBJS \
|
||||
ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
|
||||
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
|
||||
MMI-OBJS LSX-OBJS LASX-OBJS RV-OBJS RVV-OBJS RVVB-OBJS \
|
||||
OBJS SHLIBOBJS STLIBOBJS HOSTOBJS TESTOBJS SIMD128-OBJS \
|
||||
SVE-OBJS SVE2-OBJS SME-OBJS SME2-OBJS
|
||||
OBJS SHLIBOBJS STLIBOBJS HOSTOBJS TESTOBJS SIMD128-OBJS
|
||||
|
||||
define RESET
|
||||
$(1) :=
|
||||
@@ -147,7 +144,7 @@ else
|
||||
endif
|
||||
|
||||
%$(PROGSSUF)_g$(EXESUF): $(FF_DEP_LIBS)
|
||||
$(call LINK,$(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS))
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
|
||||
|
||||
VERSION_SH = $(SRC_PATH)/ffbuild/version.sh
|
||||
ifeq ($(VERSION_TRACKING),yes)
|
||||
@@ -187,7 +184,7 @@ clean::
|
||||
$(RM) -rf coverage.info coverage.info.in lcov
|
||||
|
||||
distclean:: clean
|
||||
$(RM) .version config.asm config.h config_components.* mapfile \
|
||||
$(RM) .version config.asm config.h config_components.h mapfile \
|
||||
ffbuild/.config ffbuild/config.* libavutil/avconfig.h \
|
||||
version.h libavutil/ffversion.h libavcodec/codec_names.h \
|
||||
libavcodec/bsf_list.c libavformat/protocol_list.c \
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
┌────────────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 8.0 "Huffman" │
|
||||
└────────────────────────────────────────┘
|
||||
|
||||
The FFmpeg Project proudly presents FFmpeg 8.0 "Huffman", about 11
|
||||
months after the release of FFmpeg 7.1.
|
||||
|
||||
A complete Changelog is available at the root of the project, and the
|
||||
complete Git history on https://git.ffmpeg.org/gitweb/ffmpeg.git
|
||||
|
||||
We hope you will like this release as much as we enjoyed working on it, and
|
||||
as usual, if you have any questions about it, or any FFmpeg related topic,
|
||||
feel free to join us on the #ffmpeg IRC channel (on irc.libera.chat) or ask
|
||||
on the mailing-lists.
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Android Binder handler
|
||||
*
|
||||
* Copyright (c) 2025 Dmitrii Okunev
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libavutil/log.h"
|
||||
#include "binder.h"
|
||||
|
||||
#define THREAD_POOL_SIZE 1
|
||||
|
||||
static void *dlopen_libbinder_ndk(void)
|
||||
{
|
||||
/*
|
||||
* libbinder_ndk.so often does not contain the functions we need, so making
|
||||
* this dependency optional, thus using dlopen/dlsym instead of linking.
|
||||
*
|
||||
* See also: https://source.android.com/docs/core/architecture/aidl/aidl-backends
|
||||
*/
|
||||
|
||||
void *h = dlopen("libbinder_ndk.so", RTLD_NOW | RTLD_LOCAL);
|
||||
if (h != NULL)
|
||||
return h;
|
||||
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"android/binder: unable to load libbinder_ndk.so: '%s'; skipping binder threadpool init (MediaCodec likely won't work)\n",
|
||||
dlerror());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void android_binder_threadpool_init(void)
|
||||
{
|
||||
typedef int (*set_thread_pool_max_fn)(uint32_t);
|
||||
typedef void (*start_thread_pool_fn)(void);
|
||||
|
||||
set_thread_pool_max_fn set_thread_pool_max = NULL;
|
||||
start_thread_pool_fn start_thread_pool = NULL;
|
||||
|
||||
void *h = dlopen_libbinder_ndk();
|
||||
if (h == NULL)
|
||||
return;
|
||||
|
||||
unsigned thead_pool_size = THREAD_POOL_SIZE;
|
||||
|
||||
set_thread_pool_max =
|
||||
(set_thread_pool_max_fn) dlsym(h,
|
||||
"ABinderProcess_setThreadPoolMaxThreadCount");
|
||||
start_thread_pool =
|
||||
(start_thread_pool_fn) dlsym(h, "ABinderProcess_startThreadPool");
|
||||
|
||||
if (start_thread_pool == NULL) {
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"android/binder: ABinderProcess_startThreadPool not found; skipping threadpool init (MediaCodec likely won't work)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (set_thread_pool_max != NULL) {
|
||||
int ok = set_thread_pool_max(thead_pool_size);
|
||||
av_log(NULL, AV_LOG_DEBUG,
|
||||
"android/binder: ABinderProcess_setThreadPoolMaxThreadCount(%u) => %s\n",
|
||||
thead_pool_size, ok ? "ok" : "fail");
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_DEBUG,
|
||||
"android/binder: ABinderProcess_setThreadPoolMaxThreadCount is unavailable; using the library default\n");
|
||||
}
|
||||
|
||||
start_thread_pool();
|
||||
av_log(NULL, AV_LOG_DEBUG,
|
||||
"android/binder: ABinderProcess_startThreadPool() called\n");
|
||||
}
|
||||
|
||||
void android_binder_threadpool_init_if_required(void)
|
||||
{
|
||||
#if __ANDROID_API__ >= 24
|
||||
if (android_get_device_api_level() < 35) {
|
||||
// the issue with the thread pool was introduced in Android 15 (API 35)
|
||||
av_log(NULL, AV_LOG_DEBUG,
|
||||
"android/binder: API<35, thus no need to initialize a thread pool\n");
|
||||
return;
|
||||
}
|
||||
android_binder_threadpool_init();
|
||||
#else
|
||||
// android_get_device_api_level was introduced in API 24, so we cannot use it
|
||||
// to detect the API level in API<24. For simplicity we just assume
|
||||
// libbinder_ndk.so on the system running this code would have API level < 35;
|
||||
av_log(NULL, AV_LOG_DEBUG,
|
||||
"android/binder: is built with API<24, assuming this is not Android 15+\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __ANDROID__ */
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Android Binder handler
|
||||
*
|
||||
* Copyright (c) 2025 Dmitrii Okunev
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it 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 COMPAT_ANDROID_BINDER_H
|
||||
#define COMPAT_ANDROID_BINDER_H
|
||||
|
||||
/**
|
||||
* Initialize Android Binder thread pool.
|
||||
*/
|
||||
void android_binder_threadpool_init_if_required(void);
|
||||
|
||||
#endif // COMPAT_ANDROID_BINDER_H
|
||||
+1
-1
@@ -38,7 +38,7 @@ static int optind = 1;
|
||||
static int optopt;
|
||||
static char *optarg;
|
||||
|
||||
static int getopt(int argc, char *argv[], const char *opts)
|
||||
static int getopt(int argc, char *argv[], char *opts)
|
||||
{
|
||||
static int sp = 1;
|
||||
int c;
|
||||
|
||||
+6
-41
@@ -44,9 +44,8 @@
|
||||
#include "libavutil/internal.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/time.h"
|
||||
#include "libavutil/wchar_filename.h"
|
||||
|
||||
typedef struct w32pthread_t {
|
||||
typedef struct pthread_t {
|
||||
void *handle;
|
||||
void *(*func)(void* arg);
|
||||
void *arg;
|
||||
@@ -72,7 +71,7 @@ typedef CONDITION_VARIABLE pthread_cond_t;
|
||||
#define THREADFUNC_RETTYPE unsigned
|
||||
#endif
|
||||
|
||||
av_unused static THREADFUNC_RETTYPE
|
||||
static av_unused THREADFUNC_RETTYPE
|
||||
__stdcall attribute_align_arg win32thread_worker(void *arg)
|
||||
{
|
||||
pthread_t h = (pthread_t)arg;
|
||||
@@ -80,12 +79,12 @@ __stdcall attribute_align_arg win32thread_worker(void *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
av_unused static int pthread_create(pthread_t *thread, const void *unused_attr,
|
||||
static av_unused int pthread_create(pthread_t *thread, const void *unused_attr,
|
||||
void *(*start_routine)(void*), void *arg)
|
||||
{
|
||||
pthread_t ret;
|
||||
|
||||
ret = (pthread_t)av_mallocz(sizeof(*ret));
|
||||
ret = av_mallocz(sizeof(*ret));
|
||||
if (!ret)
|
||||
return EAGAIN;
|
||||
|
||||
@@ -109,7 +108,7 @@ av_unused static int pthread_create(pthread_t *thread, const void *unused_attr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
av_unused static int pthread_join(pthread_t thread, void **value_ptr)
|
||||
static av_unused int pthread_join(pthread_t thread, void **value_ptr)
|
||||
{
|
||||
DWORD ret = WaitForSingleObject(thread->handle, INFINITE);
|
||||
if (ret != WAIT_OBJECT_0) {
|
||||
@@ -149,7 +148,7 @@ static inline int pthread_mutex_unlock(pthread_mutex_t *m)
|
||||
typedef INIT_ONCE pthread_once_t;
|
||||
#define PTHREAD_ONCE_INIT INIT_ONCE_STATIC_INIT
|
||||
|
||||
av_unused static int pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
|
||||
static av_unused int pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
|
||||
{
|
||||
BOOL pending = FALSE;
|
||||
InitOnceBeginInitialize(once_control, 0, &pending, NULL);
|
||||
@@ -210,38 +209,4 @@ static inline int pthread_setcancelstate(int state, int *oldstate)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int win32_thread_setname(const char *name)
|
||||
{
|
||||
#if !HAVE_UWP
|
||||
typedef HRESULT (WINAPI *SetThreadDescriptionFn)(HANDLE, PCWSTR);
|
||||
|
||||
// Although SetThreadDescription lives in kernel32.dll, on Windows Server 2016,
|
||||
// Windows 10 LTSB 2016 and Windows 10 version 1607, it was only available in
|
||||
// kernelbase.dll. So, load it from there for maximum coverage.
|
||||
HMODULE kernelbase = GetModuleHandleW(L"kernelbase.dll");
|
||||
if (!kernelbase)
|
||||
return AVERROR(ENOSYS);
|
||||
|
||||
SetThreadDescriptionFn pSetThreadDescription =
|
||||
(SetThreadDescriptionFn)GetProcAddress(kernelbase, "SetThreadDescription");
|
||||
if (!pSetThreadDescription)
|
||||
return AVERROR(ENOSYS);
|
||||
|
||||
wchar_t *wname;
|
||||
if (utf8towchar(name, &wname) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
HRESULT hr = pSetThreadDescription(GetCurrentThread(), wname);
|
||||
av_free(wname);
|
||||
return SUCCEEDED(hr) ? 0 : AVERROR(EINVAL);
|
||||
#else
|
||||
// UWP is not supported because we cannot use LoadLibrary/GetProcAddress to
|
||||
// detect the availability of the SetThreadDescription API. There is a small
|
||||
// gap in Windows builds 1507-1607 where it was not available. UWP allows
|
||||
// querying the availability of APIs with QueryOptionalDelayLoadedAPI, but it
|
||||
// requires /DELAYLOAD:kernel32.dll during linking, and we cannot enforce that.
|
||||
return AVERROR(ENOSYS);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* COMPAT_W32PTHREADS_H */
|
||||
|
||||
+5
-20
@@ -48,13 +48,7 @@ trap 'rm -f -- $libname' EXIT
|
||||
if [ -n "$AR" ]; then
|
||||
$AR rcs ${libname} $@ >/dev/null
|
||||
else
|
||||
machine_flag=""
|
||||
case "$LDFLAGS" in
|
||||
*"machine:arm64ec"*)
|
||||
machine_flag="-machine:arm64ec"
|
||||
;;
|
||||
esac
|
||||
lib.exe ${machine_flag} -out:${libname} $@ >/dev/null
|
||||
lib.exe -out:${libname} $@ >/dev/null
|
||||
fi
|
||||
if [ $? != 0 ]; then
|
||||
echo "Could not create temporary library." >&2
|
||||
@@ -112,21 +106,12 @@ if [ -n "$NM" ]; then
|
||||
grep -v : |
|
||||
grep -v ^$ |
|
||||
cut -d' ' -f3 |
|
||||
sed -e "s/^${prefix}//" -e "s/^#//" |
|
||||
grep -v '\$entry_thunk' |
|
||||
grep -v '\$exit_thunk')
|
||||
sed -e "s/^${prefix}//")
|
||||
else
|
||||
member=1
|
||||
case "$LDFLAGS" in
|
||||
*"machine:arm64ec"*)
|
||||
member=32
|
||||
;;
|
||||
esac
|
||||
dump=$(dumpbin.exe -linkermember:${member} ${libname} |
|
||||
sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e 's/^[[:space:]]*[0-9A-Fa-f]\{1,\}[[:space:]]\{1,\}//' -e "s/^${prefix}//" -e 's/^#//' |
|
||||
dump=$(dumpbin.exe -linkermember:1 ${libname} |
|
||||
sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e "s/ \{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' |
|
||||
tail -n +2 |
|
||||
grep -v '\$entry_thunk' |
|
||||
grep -v '\$exit_thunk')
|
||||
cut -d' ' -f3)
|
||||
fi
|
||||
|
||||
rm ${libname}
|
||||
|
||||
-136
@@ -2,142 +2,6 @@ The last version increases of all libraries were on 2025-03-28
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2026-03-07 - c23d56b173a - lavc 62.26.100 - codec_desc.h
|
||||
Add AV_CODEC_PROP_ENHANCEMENT.
|
||||
|
||||
2026-03-07 - f37cfb370f8 - lavc 62.25.100 - avcodec.h
|
||||
Deprecate AVCodecContext.intra_dc_precision.
|
||||
|
||||
2026-02-26 - 26d6ac56c10 - lsws 9.4.100 - swscale.h
|
||||
Add sws_test_hw_format().
|
||||
|
||||
2026-02-19 - ca011ee7547 - lavf 62.10.100 - avformat.h
|
||||
Add demuxer command API consisting of:
|
||||
- Add avformat_send_command().
|
||||
- Add avformat_receive_command_reply().
|
||||
- Add enum AVFormatCommandID.
|
||||
|
||||
2026-02-13 - 66766bb1c76 - lavu 60.25.100 - avassert.h
|
||||
Deprecate av_assert0_fpu() and av_assert2_fpu() without replacement.
|
||||
|
||||
2026-02-09 - f2b13f783ac - lavf 62.9.100 - avformat.h
|
||||
Add AVFormatContext.name.
|
||||
|
||||
2026-01-26 - 714152dd9a0 - lavu 60.24.100 - hwcontext_d3d11va.h
|
||||
Add BindFlags and MiscFlags to AVD3D11VADeviceContext
|
||||
|
||||
2026-01-04 - 0645c484537 - lavu 60.23.100 - cpu.h
|
||||
Add AV_CPU_FLAG_ARM_CRC.
|
||||
|
||||
2026-01-04 - e382772e4a1 - lavu 60.22.100 - cpu.h
|
||||
Add AV_CPU_FLAG_CLMUL.
|
||||
|
||||
2025-12-29 - a6e5fa3fbb5 - lavu 60.21.100 - iamf.h
|
||||
Add nb_demixing_matrix to AVIAMFLayer
|
||||
|
||||
2025-12-13 - b8ee68cffe - lavc 62.23.100 - codec_id.h
|
||||
Add AV_CODEC_ID_JPEGXS.
|
||||
|
||||
2025-12-12 - c9b5e145b71 - lavf 62.7.100 - avformat.h
|
||||
Add av_mime_codec_str
|
||||
|
||||
2025-12-08 - 212eb8413a6 - lavu 60.20.100 - hwcontext_vulkan.h
|
||||
Add av_vk_get_optional_instance_extensions().
|
||||
Add av_vk_get_optional_device_extensions().
|
||||
|
||||
2025-12-07 - 00caeba050d - lavc 62.22.101 - avcodec.h
|
||||
Add avcodec_receive_frame_flags().
|
||||
Add AV_CODEC_RECEIVE_FRAME_FLAG_SYNCHRONOUS.
|
||||
|
||||
2025-11-26 - 623669a02cd - lavfi 11.10.100 - buffersrc.h
|
||||
Add av_buffersrc_get_status().
|
||||
|
||||
2025-11-18 - 140b4f28c30 - lavu 60.19.100 - hwcontext_amf.h
|
||||
avutil/hwcontext_amf: add lock and unlock for AVAMFDeviceContext.
|
||||
|
||||
2025-11-16 - 643e2e10f98 - lavu 60.18.100 - cpu.h
|
||||
Deprecate AV_CPU_FLAG_FORCE without replacement.
|
||||
|
||||
2025-11-01 - 8a322c956f3 - lavc 62.19.100 - avcodec.h
|
||||
Schedule AVCodecParser and av_parser_init() to use enum AVCodecID
|
||||
for codec ids on the next major version bump.
|
||||
|
||||
2025-11-01 - e0b0ca81112 - lavc 62.18.100 - avcodec.h
|
||||
Deprecate AVCodecParser fields priv_data_size, parser_init,
|
||||
parser_parse, parser_close, and split with no replacement.
|
||||
|
||||
2025-10-30 - 6879c8ee5dd - lavc 62.17.100 - packet.h
|
||||
Add av_packet_side_data_from_frame() and av_packet_side_data_to_frame().
|
||||
|
||||
2025-10-28 - 71c7b9156bd - lavu 60.16.100 - pixfmt.h
|
||||
Add AVCOL_TRC_EXT_BASE, AVCOL_TRC_V_LOG,
|
||||
AVCOL_PRI_EXT_BASE and AVCOL_PRI_V_GAMUT.
|
||||
|
||||
2025-10-24 - 00e43619cd3 - lavu 60.14.100 - csp.h
|
||||
Add av_csp_approximate_eotf_gamma().
|
||||
|
||||
2025-08-xx - xxxxxxxxxx - lavf 62.6.100 - oggparsevorbis.h oggparseopus.h oggparseflac.h
|
||||
Drop header packets from secondary chained ogg/{flac, opus, vorbis} streams
|
||||
from demuxer output.
|
||||
|
||||
2025-09-08 - 1b97966199f - lavu 60.13.100 - hwcontext_d3d12va.h
|
||||
Add resource_flags and heap_flags to AVD3D12VADeviceContext
|
||||
Add heap_flags to AVD3D12VAFramesContext
|
||||
|
||||
2025-09-05 - 9458a6f8ec2 - lavf 62.5.100 - avformat.h
|
||||
Add AV_FRAME_FILENAME_FLAGS_IGNORE_TRUNCATION
|
||||
|
||||
2025-09-03 - c2ce3873859 - lavu 60.12.100 - hwcontext_d3d12va.h
|
||||
Add support for texture array mode AVD3D12VAFrame.subresource_index,
|
||||
AVD3D12VAFramesContext.texture_array
|
||||
Add enum AVD3D12VAFrameFlags to define the behaviours of frame allocation.
|
||||
Renanme AVD3D12VAFramesContext.flags to AVD3D12VAFramesContext.resource_flags.
|
||||
Add flags to AVD3D12VAFramesContext
|
||||
Add flags to AVD3D12VAFrame
|
||||
|
||||
2025-09-02 - de297ae2fca - lavfi 11.8.100 - buffersrc.h
|
||||
Add AVBufferSrcParameters.alpha_mode.
|
||||
|
||||
2025-09-02 - 0fbd90d78f8 - lavfi 11.7.100 - buffersink.h
|
||||
Add av_buffersink_get_alpha_mode().
|
||||
|
||||
2025-09-02 - ecebf9c6935 - lavc 62.15.100 - avcodec.h codec_par.h
|
||||
Add AVCodecContext.alpha_mode, AVCodecParameters.alpha_mode, and
|
||||
AV_CODEC_CONFIG_ALPHA_MODE.
|
||||
|
||||
2025-09-02 - eea99a77eda - lavfi 11.6.100 - avfilter.h
|
||||
Add AVFilterLink.alpha_mode.
|
||||
|
||||
2025-09-02 - 22929bd044c - lavu 60.11.100 - frame.h pixfmt.h
|
||||
Add AVAlphaMode, AVFrame.alpha_mode, av_alpha_mode_name() and
|
||||
av_alpha_mode_from_name().
|
||||
|
||||
2025-09-01 - ce0938da8cd - lsws 9.3.100 - swscale.h
|
||||
Add SWS_UNSTABLE flag.
|
||||
|
||||
2025-09-01 - 4ffd621523e - lavc 62.14.100 - packet.h
|
||||
Add AV_PKT_DATA_EXIF
|
||||
|
||||
2025-08-24 - 368b5e0ffc2 - lavc 62.13.101 - exif.h
|
||||
Add AV_EXIF_FLAG_RECURSIVE
|
||||
|
||||
2025-08-19 - ad77345a5d1..fe496b0308f - lavc 62.13.100 - exif.h
|
||||
Add:
|
||||
- enum AVTiffDataType, enum AVExifHeaderMode
|
||||
- struct AVExifMetadata, struct AVExifEntry
|
||||
- av_exif_get_tag_name, av_exif_get_tag_id,
|
||||
av_exif_set_entry, av_exif_get_entry,
|
||||
av_exif_remove_entry, av_exif_parse_buffer,
|
||||
av_exif_write, av_exif_free,
|
||||
av_exif_ifd_to_dict, av_exif_clone_ifd,
|
||||
av_exif_matrix_to_orientation,
|
||||
av_exif_orientation_to_matrix,
|
||||
|
||||
2025-08-19 - bb90b262d6d - lavu 60.10.100 - frame.h
|
||||
Add AV_FRAME_DATA_EXIF.
|
||||
|
||||
-------- 8< --------- FFmpeg 8.0 was cut here -------- 8< ---------
|
||||
|
||||
2025-07-29 - 1c85a3832af - lavc 62.10.100 - smpte_436m.h
|
||||
Add a new public header smpte_436m.h with API for
|
||||
manipulating AV_CODEC_ID_SMPTE_436M_ANC data.
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_NUMBER = 8.0
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
@@ -295,7 +295,7 @@ MARKDOWN_SUPPORT = YES
|
||||
|
||||
# When enabled doxygen tries to link words that correspond to documented
|
||||
# classes, or namespaces to their corresponding documentation. Such a link can
|
||||
# be prevented in individual cases by putting a % sign in front of the word
|
||||
# be prevented in individual cases by by putting a % sign in front of the word
|
||||
# or globally by setting AUTOLINK_SUPPORT to NO.
|
||||
# The default value is: YES.
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ HTMLPAGES = $(AVPROGS-yes:%=doc/%.html) $(AVPROGS-yes:%=doc/%-all.html) $(COMP
|
||||
doc/mailing-list-faq.html \
|
||||
doc/nut.html \
|
||||
doc/platform.html \
|
||||
doc/drawvg-reference.html \
|
||||
$(SRC_PATH)/doc/bootstrap.min.css \
|
||||
$(SRC_PATH)/doc/style.min.css \
|
||||
$(SRC_PATH)/doc/default.css \
|
||||
|
||||
@@ -913,8 +913,6 @@ Set expressions for PTS, DTS or both.
|
||||
Set expression for duration.
|
||||
@item time_base
|
||||
Set output time base.
|
||||
@item prescale
|
||||
Set whether to convert time fields to user-set output time base before evaluation of expressions. Defaults to 0.
|
||||
@end table
|
||||
|
||||
The expressions are evaluated through the eval API and can contain the following
|
||||
@@ -975,7 +973,7 @@ The next input PTS.
|
||||
The next input duration.
|
||||
|
||||
@item TB
|
||||
The timebase in which time fields are denominated. The user-set output timebase if prescale is enabled, else the input timebase.
|
||||
The timebase of stream packet belongs.
|
||||
|
||||
@item TB_OUT
|
||||
The output timebase.
|
||||
|
||||
@@ -913,14 +913,6 @@ Possible values:
|
||||
|
||||
@end table
|
||||
|
||||
@item alpha_mode @var{integer} (@emph{decoding/encoding,video})
|
||||
Possible values:
|
||||
@table @samp
|
||||
@item premultiplied
|
||||
@item straight
|
||||
@end table
|
||||
|
||||
|
||||
@item log_level_offset @var{integer}
|
||||
Set the log level offset.
|
||||
|
||||
|
||||
+10
-9
@@ -119,6 +119,16 @@ The following options are supported by the libdav1d wrapper.
|
||||
|
||||
@table @option
|
||||
|
||||
@item framethreads
|
||||
Set amount of frame threads to use during decoding. The default value is 0 (autodetect).
|
||||
This option is deprecated for libdav1d >= 1.0 and will be removed in the future. Use the
|
||||
option @code{max_frame_delay} and the global option @code{threads} instead.
|
||||
|
||||
@item tilethreads
|
||||
Set amount of tile threads to use during decoding. The default value is 0 (autodetect).
|
||||
This option is deprecated for libdav1d >= 1.0 and will be removed in the future. Use the
|
||||
global option @code{threads} instead.
|
||||
|
||||
@item max_frame_delay
|
||||
Set max amount of frames the decoder may buffer internally. The default value is 0
|
||||
(autodetect).
|
||||
@@ -346,15 +356,6 @@ value is 0 (disabled).
|
||||
|
||||
@end table
|
||||
|
||||
@section libmpeghdec
|
||||
|
||||
libmpeghdec decoder wrapper.
|
||||
|
||||
libmpeghdec allows libmpeghdec to decode the MPEG-H 3D audio codec.
|
||||
Requires the presence of the libmpeghdec headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libmpeghdec --enable-nonfree}.
|
||||
|
||||
@section libopencore-amrnb
|
||||
|
||||
libopencore-amrnb decoder wrapper.
|
||||
|
||||
+24
-23
@@ -281,11 +281,7 @@ This demuxer accepts the following option:
|
||||
@table @option
|
||||
|
||||
@item cenc_decryption_key
|
||||
Default 16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
|
||||
|
||||
@item cenc_decryption_keys
|
||||
Dictionary of 16-byte key ID => 16-byte key, both in hex, to decrypt files encrypted using ISO Common Encryption
|
||||
(CENC/AES-128 CTR; ISO/IEC 23001-7).
|
||||
16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
|
||||
|
||||
@end table
|
||||
|
||||
@@ -668,9 +664,30 @@ Select a glob wildcard pattern type.
|
||||
|
||||
The pattern is interpreted like a @code{glob()} pattern. This is only
|
||||
selectable if libavformat was compiled with globbing support.
|
||||
|
||||
@item glob_sequence @emph{(deprecated, will be removed)}
|
||||
Select a mixed glob wildcard/sequence pattern.
|
||||
|
||||
If your version of libavformat was compiled with globbing support, and
|
||||
the provided pattern contains at least one glob meta character among
|
||||
@code{%*?[]@{@}} that is preceded by an unescaped "%", the pattern is
|
||||
interpreted like a @code{glob()} pattern, otherwise it is interpreted
|
||||
like a sequence pattern.
|
||||
|
||||
All glob special characters @code{%*?[]@{@}} must be prefixed
|
||||
with "%". To escape a literal "%" you shall use "%%".
|
||||
|
||||
For example the pattern @code{foo-%*.jpeg} will match all the
|
||||
filenames prefixed by "foo-" and terminating with ".jpeg", and
|
||||
@code{foo-%?%?%?.jpeg} will match all the filenames prefixed with
|
||||
"foo-", followed by a sequence of three characters, and terminating
|
||||
with ".jpeg".
|
||||
|
||||
This pattern type is deprecated in favor of @var{glob} and
|
||||
@var{sequence}.
|
||||
@end table
|
||||
|
||||
Default value is @var{sequence}.
|
||||
Default value is @var{glob_sequence}.
|
||||
@item pixel_format
|
||||
Set the pixel format of the images to read. If not specified the pixel
|
||||
format is guessed from the first image file in the sequence.
|
||||
@@ -944,11 +961,7 @@ Fixed key used for handling Audible AAX/AAX+ files. It has been pre-set so shoul
|
||||
specify.
|
||||
|
||||
@item decryption_key
|
||||
Default 16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
|
||||
|
||||
@item decryption_keys
|
||||
Dictionary of 16-byte key ID => 16-byte key, both in hex, to decrypt files encrypted using ISO Common Encryption
|
||||
(CENC/AES-128 CTR; ISO/IEC 23001-7).
|
||||
16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
|
||||
|
||||
@item max_stts_delta
|
||||
Very high sample deltas written in a trak's stts box may occasionally be intended but usually they are written in
|
||||
@@ -1043,11 +1056,6 @@ Set input video frame rate. Default value is 25.
|
||||
@item pixel_format
|
||||
Set the input video pixel format. Default value is @code{yuv420p}.
|
||||
|
||||
@item stride
|
||||
Set frame line size in bytes, only required if there are extra padding.
|
||||
For multiplane formats, @option{stride} is a list of line size for each
|
||||
plane.
|
||||
|
||||
@item video_size
|
||||
Set the input video size. This value must be specified explicitly.
|
||||
@end table
|
||||
@@ -1060,13 +1068,6 @@ the command:
|
||||
ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 input.raw
|
||||
@end example
|
||||
|
||||
Read a rawvideo with @command{ffplay}, assuming a pixel format of @code{yuv420p},
|
||||
a video size of @code{1080x1920}, has 8 bytes of padding in each line of Y plane,
|
||||
and 4 bytes of padding with UV plane,
|
||||
@example
|
||||
ffplay -f rawvideo -pixel_format yuv420p -video_size 1080x1920 -stride 1088,544,544 input.raw
|
||||
@end example
|
||||
|
||||
@anchor{rcwtdec}
|
||||
@section rcwt
|
||||
|
||||
|
||||
+1
-6
@@ -45,7 +45,6 @@ maintained and developed.
|
||||
@end itemize
|
||||
|
||||
All proposed code changes should be submitted for review to
|
||||
@url{https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls, Forgejo} or
|
||||
@url{mailto:ffmpeg-devel@@ffmpeg.org, the development mailing list}, as
|
||||
described in more detail in the @ref{Submitting patches} chapter. The code
|
||||
should comply with the @ref{Development Policy} and follow the @ref{Coding Rules}.
|
||||
@@ -367,9 +366,6 @@ symbols. If in doubt, just avoid names starting with @code{_} altogether.
|
||||
@item
|
||||
Casts should be used only when necessary. Unneeded parentheses
|
||||
should also be avoided if they don't make the code easier to understand.
|
||||
@item
|
||||
Where applicable, SI units shall be used. For example timeouts should use seconds as the fundamental unit not micro seconds.
|
||||
That means a bare value like @samp{1.0} must mean 1 second, @samp{50m} means 50 milliseconds. For weight, gram shall be used.
|
||||
@end itemize
|
||||
|
||||
@anchor{Development Policy}
|
||||
@@ -726,8 +722,7 @@ and has no lrint()')
|
||||
Also please if you send several patches, send each patch as a separate mail,
|
||||
do not attach several unrelated patches to the same mail.
|
||||
|
||||
Patches should be posted to
|
||||
@uref{https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls, Forgejo} or the
|
||||
Patches should be posted to the
|
||||
@uref{https://lists.ffmpeg.org/mailman/listinfo/ffmpeg-devel, ffmpeg-devel}
|
||||
mailing list. Use @code{git send-email} when possible since it will properly
|
||||
send patches without requiring extra care. If you cannot, then send patches
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+2
-134
@@ -1996,49 +1996,6 @@ by ":". See the SVT-AV1 encoder user guide for a list of accepted parameters.
|
||||
|
||||
@end table
|
||||
|
||||
@section libsvtjpegxs
|
||||
|
||||
SVT-JPEG-XS encoder wrapper.
|
||||
|
||||
Requires the presence of the SVT-JPEG-XS headers and library during configuration.
|
||||
You need to explicitly configure the build with @code{--enable-libsvtjpegxs}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
@item decomp_v
|
||||
Set vertical decomposition level
|
||||
@item decomp_h
|
||||
Set horizontal decomposition level
|
||||
|
||||
@item quantization
|
||||
Set the quantization algorithm.
|
||||
@table @samp
|
||||
@item deadzone
|
||||
@item uniform
|
||||
@end table
|
||||
|
||||
@item coding-signs
|
||||
Enable Signs handling strategy
|
||||
@table @samp
|
||||
@item disable
|
||||
@item fast
|
||||
@item full
|
||||
@end table
|
||||
|
||||
@item coding-sigf
|
||||
Enable Significance coding
|
||||
|
||||
@item coding-vpred
|
||||
Enable Vertical Prediction coding
|
||||
@table @samp
|
||||
@item disable
|
||||
@item no_residuals
|
||||
@item no_coeffs
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@section libjxl
|
||||
|
||||
libjxl JPEG XL encoder wrapper.
|
||||
@@ -3083,10 +3040,6 @@ Quantizer curve compression factor
|
||||
Normally, when forcing a I-frame type, the encoder can select any type
|
||||
of I-frame. This option forces it to choose an IDR-frame.
|
||||
|
||||
@item x265-stats
|
||||
Specify the file name for 2-pass stats. This is set automatically when using
|
||||
the @option{-passlogfile} option.
|
||||
|
||||
@item udu_sei @var{boolean}
|
||||
Import user data unregistered SEI if available into output. Default is 0 (off).
|
||||
|
||||
@@ -3460,97 +3413,12 @@ Maximum quantization parameter for B frame.
|
||||
|
||||
@section MediaFoundation
|
||||
|
||||
The following wrappers for encoders in the MediaFoundation framework are
|
||||
available:
|
||||
|
||||
@itemize
|
||||
@item h264_mf
|
||||
@item hevc_mf
|
||||
@item av1_mf
|
||||
@end itemize
|
||||
|
||||
These support both software and hardware encoding.
|
||||
|
||||
This provides wrappers to encoders (both audio and video) in the
|
||||
MediaFoundation framework. It can access both SW and HW encoders.
|
||||
Video encoders can take input in either of nv12 or yuv420p form
|
||||
(some encoders support both, some support only either - in practice,
|
||||
nv12 is the safer choice, especially among HW encoders).
|
||||
|
||||
Hardware-accelerated encoding requires D3D11, including hardware
|
||||
scaling capabilities through the scale_d3d11 filter.
|
||||
|
||||
To list all available options for the MediaFoundation encoders, use:
|
||||
@command{ffmpeg -h encoder=<encoder>} e.g. @command{ffmpeg -h encoder=h264_mf}
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
@item rate_control
|
||||
Select rate control mode. Available modes:
|
||||
|
||||
@table @samp
|
||||
@item default
|
||||
Default mode
|
||||
@item cbr
|
||||
CBR mode
|
||||
@item pc_vbr
|
||||
Peak constrained VBR mode
|
||||
@item u_vbr
|
||||
Unconstrained VBR mode
|
||||
@item quality
|
||||
Quality mode
|
||||
@item ld_vbr
|
||||
Low delay VBR mode (requires Windows 8+)
|
||||
@item g_vbr
|
||||
Global VBR mode (requires Windows 8+)
|
||||
@item gld_vbr
|
||||
Global low delay VBR mode (requires Windows 8+)
|
||||
@end table
|
||||
|
||||
@item scenario
|
||||
Select usage scenario. Available scenarios:
|
||||
|
||||
@table @samp
|
||||
@item default
|
||||
Default scenario
|
||||
@item display_remoting
|
||||
Display remoting scenario
|
||||
@item video_conference
|
||||
Video conference scenario
|
||||
@item archive
|
||||
Archive scenario
|
||||
@item live_streaming
|
||||
Live streaming scenario
|
||||
@item camera_record
|
||||
Camera record scenario
|
||||
@item display_remoting_with_feature_map
|
||||
Display remoting with feature map scenario
|
||||
@end table
|
||||
|
||||
@item quality
|
||||
Set encoding quality (0-100). -1 means default quality.
|
||||
|
||||
@item hw_encoding
|
||||
Force hardware encoding (0-1). Default is 0 (disabled).
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
||||
Hardware encoding:
|
||||
@example
|
||||
ffmpeg -i input.mp4 -c:v h264_mf -hw_encoding 1 output.mp4
|
||||
@end example
|
||||
|
||||
Hardware-accelerated decoding with hardware encoding:
|
||||
@example
|
||||
ffmpeg -hwaccel d3d11va -i input.mp4 -c:v h264_mf -hw_encoding 1 output.mp4
|
||||
@end example
|
||||
|
||||
Hardware-accelerated decoding, HW scaling and encoding with quality setting:
|
||||
@example
|
||||
ffmpeg -hwaccel d3d11va -hwaccel_output_format d3d11 -i input.mp4 -vf scale_d3d11=1920:1080 -c:v hevc_mf -hw_encoding 1 -quality 80 output.mp4
|
||||
@end example
|
||||
|
||||
@section Microsoft RLE
|
||||
|
||||
Microsoft RLE aka MSRLE encoder.
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
* file to be played with ffplay.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavfilter/buffersink.h>
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
* @example decode_filter_video.c
|
||||
*/
|
||||
|
||||
#define _XOPEN_SOURCE 600 /* for usleep */
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -36,7 +38,6 @@
|
||||
#include <libavfilter/buffersrc.h>
|
||||
#include <libavutil/mem.h>
|
||||
#include <libavutil/opt.h>
|
||||
#include <libavutil/time.h>
|
||||
|
||||
const char *filter_descr = "scale=78:24,transpose=cclock";
|
||||
/* other way:
|
||||
@@ -194,7 +195,7 @@ static void display_frame(const AVFrame *frame, AVRational time_base)
|
||||
delay = av_rescale_q(frame->pts - last_pts,
|
||||
time_base, AV_TIME_BASE_Q);
|
||||
if (delay > 0 && delay < 1000000)
|
||||
av_usleep(delay);
|
||||
usleep(delay);
|
||||
}
|
||||
last_pts = frame->pts;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,6 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
|
||||
ret = avcodec_parameters_to_context(dec_ctx, st->codecpar);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Failed to copy codec parameters to codec context\n");
|
||||
avcodec_free_context(&dec_ctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -215,10 +215,8 @@ int main(int argc, char *argv[])
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
video = input_ctx->streams[video_stream];
|
||||
if (avcodec_parameters_to_context(decoder_ctx, video->codecpar) < 0) {
|
||||
avcodec_free_context(&decoder_ctx);
|
||||
if (avcodec_parameters_to_context(decoder_ctx, video->codecpar) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
decoder_ctx->get_format = get_hw_format;
|
||||
|
||||
|
||||
@@ -351,10 +351,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
setting_number = (argc - 5) / 2;
|
||||
dynamic_setting = av_malloc(setting_number * sizeof(*dynamic_setting));
|
||||
if (!dynamic_setting) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto end;
|
||||
}
|
||||
current_setting_number = 0;
|
||||
for (int i = 0; i < setting_number; i++) {
|
||||
dynamic_setting[i].frame_number = atoi(argv[i*2 + 5]);
|
||||
|
||||
@@ -88,7 +88,7 @@ static int encode_write(AVCodecContext *avctx, AVFrame *frame, FILE *fout)
|
||||
enc_pkt->stream_index = 0;
|
||||
ret = fwrite(enc_pkt->data, enc_pkt->size, 1, fout);
|
||||
av_packet_unref(enc_pkt);
|
||||
if (!ret) {
|
||||
if (ret != enc_pkt->size) {
|
||||
ret = AVERROR(errno);
|
||||
break;
|
||||
}
|
||||
|
||||
+18
-38
@@ -42,60 +42,41 @@ targets and variables.
|
||||
|
||||
@chapter Using FATE from your FFmpeg source directory
|
||||
|
||||
If you want to run FATE on your machine, FFmpeg needs to be configured first.
|
||||
You may specify the location of samples during configuration by adding the
|
||||
argument @code{--samples=/path/to/fate-suite}.
|
||||
If you want to run FATE on your machine you need to have the samples
|
||||
in place. You can get the samples via the build target fate-rsync.
|
||||
Use this command from the top-level source directory:
|
||||
|
||||
@example
|
||||
./configure --enable-somelib --samples=/path/to/fate-suite
|
||||
make fate-rsync SAMPLES=fate-suite/
|
||||
make fate SAMPLES=fate-suite/
|
||||
@end example
|
||||
|
||||
After successful configuration, you need to add and/or update the samples in place:
|
||||
The above commands set the samples location by passing a makefile
|
||||
variable via command line. It is also possible to set the samples
|
||||
location at source configuration time by invoking configure with
|
||||
@option{--samples=<path to the samples directory>}. Afterwards you can
|
||||
invoke the makefile targets without setting the @var{SAMPLES} makefile
|
||||
variable. This is illustrated by the following commands:
|
||||
|
||||
@example
|
||||
make fate-rsync
|
||||
@end example
|
||||
|
||||
Now you are ready to run FATE:
|
||||
|
||||
@example
|
||||
make fate
|
||||
@end example
|
||||
|
||||
See @ref{makefile variables} for a list of arguments that can be added.
|
||||
|
||||
If you did not set the samples path during configuration, or if you wish to
|
||||
override it just before starting FATE, you can do so in one of three ways.
|
||||
|
||||
Either by setting a make variable:
|
||||
|
||||
@example
|
||||
make fate-rsync SAMPLES=/path/to/fate-suite
|
||||
make fate SAMPLES=/path/to/fate-suite
|
||||
@end example
|
||||
|
||||
or by setting an environment variable for the current session:
|
||||
|
||||
@example
|
||||
export FATE_SAMPLES=/path/to/fate-suite
|
||||
./configure --samples=fate-suite/
|
||||
make fate-rsync
|
||||
make fate
|
||||
@end example
|
||||
|
||||
or in isolation for a single command by prepending it:
|
||||
Yet another way to tell FATE about the location of the sample
|
||||
directory is by making sure the environment variable FATE_SAMPLES
|
||||
contains the path to your samples directory. This can be achieved
|
||||
by e.g. putting that variable in your shell profile or by setting
|
||||
it in your interactive session.
|
||||
|
||||
@example
|
||||
FATE_SAMPLES=/path/to/fate-suite make fate-rsync
|
||||
FATE_SAMPLES=/path/to/fate-suite make fate
|
||||
FATE_SAMPLES=fate-suite/ make fate
|
||||
@end example
|
||||
|
||||
This variable can also be set in your shell profile to make it permanent.
|
||||
|
||||
@float NOTE
|
||||
Do not put a '~' character in the samples path to indicate a home
|
||||
directory. Because of shell nuances, this will cause FATE to fail.
|
||||
Also, on Windows the path has to be relative to the build path
|
||||
which in this case is the FFmpeg source directory.
|
||||
@end float
|
||||
|
||||
Beware that some assertions are disabled by default, so mind setting
|
||||
@@ -239,7 +220,6 @@ Run the FATE test suite (requires the fate-suite dataset).
|
||||
@end table
|
||||
|
||||
@section Makefile variables
|
||||
@anchor{makefile variables}
|
||||
|
||||
@table @env
|
||||
@item V
|
||||
|
||||
@@ -6,28 +6,21 @@ workdir= # directory in which to do all the work
|
||||
#fate_recv="ssh -T fate@fate.ffmpeg.org" # command to submit report
|
||||
comment= # optional description
|
||||
build_only= # set to "yes" for a compile-only instance that skips tests
|
||||
skip_clean= # set to "yes" to preserve build/install directories
|
||||
ignore_tests=
|
||||
|
||||
# the following are optional and map to configure options
|
||||
arch=
|
||||
cpu=
|
||||
toolchain=
|
||||
cross_prefix=
|
||||
ar=
|
||||
as=
|
||||
cc=
|
||||
cxx=
|
||||
ld=
|
||||
nm=
|
||||
target_os=
|
||||
sysroot=
|
||||
target_exec=
|
||||
target_path=
|
||||
target_samples=
|
||||
extra_cflags=
|
||||
extra_cxxflags=
|
||||
extra_objcflags=
|
||||
extra_ldflags=
|
||||
extra_libs=
|
||||
extra_conf= # extra configure options not covered above
|
||||
|
||||
@@ -1665,7 +1665,6 @@ Force video tag/fourcc. This is an alias for @code{-tag:v}.
|
||||
@item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream})
|
||||
@item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} (@emph{output,per-stream})
|
||||
@item -force_key_frames[:@var{stream_specifier}] source (@emph{output,per-stream})
|
||||
@item -force_key_frames[:@var{stream_specifier}] scd_metadata (@emph{output,per-stream})
|
||||
|
||||
@var{force_key_frames} can take arguments of the following form:
|
||||
|
||||
@@ -1729,14 +1728,6 @@ the current frame being encoded is marked as a key frame in its source.
|
||||
In cases where this particular source frame has to be dropped,
|
||||
enforce the next available frame to become a key frame instead.
|
||||
|
||||
@item scd_metadata
|
||||
If the argument is @code{scd_metadata}, ffmpeg will force a key frame if
|
||||
the current frame contains a metadata entry with the key @code{lavfi.scd.time}.
|
||||
The metadata can be added by filters like @code{scdet} and @code{scdet_vulkan}.
|
||||
Avoid inserting filters that duplicate frames after @code{scdet}, as this can
|
||||
cause duplicate metadata for multiple frames and repeated insertion of key
|
||||
frames.
|
||||
|
||||
@end table
|
||||
|
||||
Note that forcing too many keyframes is very harmful for the lookahead
|
||||
|
||||
+4
-10
@@ -208,14 +208,6 @@ Vulkan configuration using a list of @var{key}=@var{value} pairs separated by
|
||||
Use HW accelerated decoding. Enable this option will enable vulkan renderer
|
||||
automatically.
|
||||
|
||||
@item -video_bg @var{pattern}
|
||||
Set the video background pattern used for transparent videos. For solid color
|
||||
patterns you can use the color name or color code as specified in the
|
||||
@ref{color syntax,,Color section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
|
||||
You can also use the special @code{tiles} keyword for a checker board style
|
||||
pattern. This is also the default. The @code{none} pattern does rendering
|
||||
without alpha blending effectively ignoring alpha channel.
|
||||
|
||||
@end table
|
||||
|
||||
@section While playing
|
||||
@@ -259,13 +251,15 @@ Pause if the stream is not already paused, step to the next video
|
||||
frame, and pause.
|
||||
|
||||
@item left/right
|
||||
Seek backward/forward by 10 seconds or a custom interval if -seek_interval is set.
|
||||
Seek backward/forward 10 seconds.
|
||||
|
||||
@item down/up
|
||||
Seek backward/forward 1 minute.
|
||||
|
||||
@item page down/page up
|
||||
Seek to previous/next chapter or backward/forward 10 minutes if no chapters.
|
||||
Seek to the previous/next chapter.
|
||||
or if there are no chapters
|
||||
Seek backward/forward 10 minutes.
|
||||
|
||||
@item right mouse click
|
||||
Seek to percentage in file corresponding to fraction of width.
|
||||
|
||||
+1
-13
@@ -117,8 +117,7 @@ ffprobe -show_packets -select_streams v:1 INPUT
|
||||
@end example
|
||||
|
||||
@item -show_data
|
||||
Show payload data, as a hexadecimal and ASCII dump (other formats can be
|
||||
selected using @option{-data_dump_format}). Coupled with
|
||||
Show payload data, as a hexadecimal and ASCII dump. Coupled with
|
||||
@option{-show_packets}, it will dump the packets' data. Coupled with
|
||||
@option{-show_streams}, it will dump the codec extradata.
|
||||
|
||||
@@ -128,11 +127,6 @@ The dump is printed as the "data" field. It may contain newlines.
|
||||
Show a hash of payload data, for packets with @option{-show_packets} and for
|
||||
codec extradata with @option{-show_streams}.
|
||||
|
||||
@item -data_dump_format @var{format}
|
||||
Select a format used for the data dumps enabled with the @option{-show_data}
|
||||
option. The default is @code{xxd} which is a hexdump format compatible with the
|
||||
well-known @command{xxd} program. @code{base64} is also supported.
|
||||
|
||||
@item -show_error
|
||||
Show information about the error found when trying to probe the input.
|
||||
|
||||
@@ -374,12 +368,6 @@ Read @var{input_url}.
|
||||
Write output to @var{output_url}. If not specified, the output is sent
|
||||
to stdout.
|
||||
|
||||
@item -c:@var{media_specifier} @var{codec_name}
|
||||
@itemx -codec:@var{media_specifier} @var{codec_name}
|
||||
Force a specific decoder implementation for the stream identified by
|
||||
@var{media_specifier}, which can assume the values @code{a} (audio),
|
||||
@code{v} (video), @code{s} (subtitle), and @code{d} (data).
|
||||
|
||||
@end table
|
||||
@c man end
|
||||
|
||||
|
||||
@@ -276,7 +276,6 @@
|
||||
<xsd:attribute name="extradata" type="xsd:string" />
|
||||
<xsd:attribute name="extradata_size" type="xsd:int" />
|
||||
<xsd:attribute name="extradata_hash" type="xsd:string" />
|
||||
<xsd:attribute name="mime_codec_string" type="xsd:string" />
|
||||
|
||||
<!-- video attributes -->
|
||||
<xsd:attribute name="width" type="xsd:int"/>
|
||||
|
||||
@@ -98,7 +98,7 @@ These options are shared amongst the ff* tools.
|
||||
|
||||
@table @option
|
||||
|
||||
@item -L, -license
|
||||
@item -L
|
||||
Show license.
|
||||
|
||||
@item -h, -?, -help, --help [@var{arg}]
|
||||
|
||||
+103
-754
File diff suppressed because it is too large
Load Diff
@@ -250,14 +250,6 @@ Go to @url{http://sourceforge.net/projects/opencore-amr/} and follow the
|
||||
instructions for installing the library.
|
||||
Then pass @code{--enable-libfdk-aac} to configure to enable it.
|
||||
|
||||
@subsection Fraunhofer MPEG-H 3D Audio decoder library
|
||||
|
||||
FFmpeg can make use of the Fraunhofer MPEG-H decoder library for MPEG-H 3DA decoding.
|
||||
|
||||
Go to @url{https://github.com/Fraunhofer-IIS/mpeghdec} and follow the
|
||||
instructions for installing the library.
|
||||
Then pass @code{--enable-libmpeghdec --enable-nonfree} to configure to enable it.
|
||||
|
||||
@subsection LC3 library
|
||||
|
||||
FFmpeg can make use of the Google LC3 library for LC3 decoding & encoding.
|
||||
@@ -303,15 +295,6 @@ Go to @url{https://gitlab.com/AOMediaCodec/SVT-AV1/} and follow the instructions
|
||||
for installing the library. Then pass @code{--enable-libsvtav1} to configure to
|
||||
enable it.
|
||||
|
||||
@section SVT-JPEG-XS
|
||||
|
||||
FFmpeg can make use of the Scalable Video Technology for JPEG-XS library for JPEG-XS
|
||||
decoding and encoding.
|
||||
|
||||
Go to @url{https://github.com/OpenVisualCloud/SVT-JPEG-XS} and follow the instructions
|
||||
for installing the library. Then pass @code{--enable-libsvtjpegxs} to configure to
|
||||
enable it.
|
||||
|
||||
@section TwoLAME
|
||||
|
||||
FFmpeg can make use of the TwoLAME library for MP2 encoding.
|
||||
@@ -828,8 +811,6 @@ following image formats are supported:
|
||||
@tab Progressive JPEG is not supported.
|
||||
@item JPEG 2000 @tab X @tab X
|
||||
@item JPEG-LS @tab X @tab X
|
||||
@item JPEG-XS @tab E @tab E
|
||||
@tab Supported through external library libsvtjpegxs
|
||||
@item LJPEG @tab X @tab
|
||||
@tab Lossless JPEG
|
||||
@item Media 100 @tab @tab X
|
||||
@@ -1363,8 +1344,6 @@ following image formats are supported:
|
||||
@item MP3 (MPEG audio layer 3) @tab E @tab IX
|
||||
@tab encoding supported through external library LAME, ADU MP3 and MP3onMP4 also supported
|
||||
@item MPEG-4 Audio Lossless Coding (ALS) @tab @tab X
|
||||
@item MPEG-H 3D Audio @tab @tab E
|
||||
@tab decoding supported through external library libmpeghdec
|
||||
@item MobiClip FastAudio @tab @tab X
|
||||
@item Musepack SV7 @tab @tab X
|
||||
@item Musepack SV8 @tab @tab X
|
||||
|
||||
@@ -4,4 +4,3 @@ ffmpeg-formats mono ./ffmpeg-formats.html
|
||||
ffmpeg-resampler mono ./ffmpeg-resampler.html
|
||||
ffmpeg-scaler mono ./ffmpeg-scaler.html
|
||||
ffmpeg-utils mono ./ffmpeg-utils.html
|
||||
drawvg-reference mono ./drawvg-reference.html
|
||||
|
||||
@@ -24,26 +24,6 @@ Our Main server is hosted at telepoint.bg
|
||||
for more details see: https://www.ffmpeg.org/#thanks_sponsor_0001
|
||||
Nothing runs on our main server directly, instead several VMs run on it.
|
||||
|
||||
Main server security:
|
||||
---------------------
|
||||
Telepoint is one of the largest Bulgarian DC providers with multiple sibling companies offering
|
||||
Internet, SDH, DWDM, peering exchange and hosting. They have multiple DC buildings in Sofia and
|
||||
FFmpeg is hosted in XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. The building is locked down and accessible
|
||||
only with personal key cards that are registered. People who are granted access to a rack have
|
||||
to go through the access center with their ID to get logged and receive a one-time access card
|
||||
that can open the service elevator and only the hall where the destination rack is. All racks are
|
||||
locked, once access is granted to someone they will get a key for the rack for the duration of
|
||||
their visit. There are security cameras everywhere and personnel in the access center 24/7. As for
|
||||
software security, our BIOS and IPMI are protected by password and encrypted connection, and
|
||||
the machines can be accessed only by root administrators with their SSH keys. They're using
|
||||
a Ubuntu LTS release and get regular security updates as they are released. We also get
|
||||
notified by email for various security related events (e.g. failed sudo).
|
||||
|
||||
Side note - Telepoint provides the rack and physical infrastructure, their sibling company called
|
||||
Telehouse which is an ISP provides the connectivity, they are directly connected with
|
||||
over 15 tier-1 service providers and have over 100 PoPs (points of presence)
|
||||
in various cities. You can see more on www.telehouse.bg
|
||||
|
||||
|
||||
ffmpeg.org VM:
|
||||
--------------
|
||||
|
||||
@@ -341,7 +341,7 @@ recommended.
|
||||
Avoid sending the same message to multiple mailing lists.
|
||||
|
||||
@item
|
||||
Please follow our @url{https://ffmpeg.org/community.html#Code-of-Conduct, Code of Conduct}.
|
||||
Please follow our @url{https://ffmpeg.org/community.html#Code-of-conduct, Code of Conduct}.
|
||||
@end itemize
|
||||
|
||||
@chapter Help
|
||||
|
||||
+1
-17
@@ -3953,23 +3953,7 @@ Default value is 5000.
|
||||
|
||||
@item pkt_size @var{integer}
|
||||
Set the maximum size, in bytes, of RTP packets that send out.
|
||||
Default value is 1200.
|
||||
|
||||
@item ts_buffer_size @var{integer}
|
||||
Set the buffer size, in bytes, of underlying protocol.
|
||||
Default value is -1(auto). The UDP auto selects a reasonable value.
|
||||
|
||||
@item whip_flags @var{flags}
|
||||
Possible values:
|
||||
|
||||
@table @samp
|
||||
@item dtls_active
|
||||
The muxer will try to set dtls active role and send the first client hello.
|
||||
@end table
|
||||
|
||||
@item rtp_history @var{integer}
|
||||
Set the number of RTP history items to store.
|
||||
Default value is 512.
|
||||
Default value is 1500.
|
||||
|
||||
@item authorization @var{string}
|
||||
The optional Bearer token for WHIP Authorization.
|
||||
|
||||
@@ -5,7 +5,7 @@ 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 x86.
|
||||
already optimized for MMX.
|
||||
|
||||
If you want to do x86 optimizations then you can either try to fine-tune the
|
||||
stuff in the x86 directory or find some other functions in the C source to
|
||||
|
||||
@@ -330,20 +330,4 @@ and for a build with shared libraries
|
||||
./configure --target-os=mingw32 --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
|
||||
@end example
|
||||
|
||||
@section ARM64EC
|
||||
|
||||
FFmpeg does not intend to support the Windows ARM64EC build configuration;
|
||||
patches for changing the individual libraries for the purposes of ARM64EC will
|
||||
not be accepted.
|
||||
|
||||
It may still be possible to build FFmpeg in this build configuration;
|
||||
such a build may seem to work to some extent. Such a build may have some
|
||||
amounts of ABI inconsistencies though - which we are not willing to fix.
|
||||
|
||||
(Changing aarch64 assembly code to strictly support ARM64EC would require
|
||||
ifdeffing/changing essentially all such assembly code, and would be a
|
||||
huge maintenance burden. Additionally, changing the library ABI
|
||||
surfaces to fix ABI inconsistencies could require extensive and intrusive
|
||||
changes.)
|
||||
|
||||
@bye
|
||||
|
||||
+46
-184
@@ -352,17 +352,6 @@ means auto (seekable for normal files, non-seekable for named pipes).
|
||||
Many demuxers handle seekable and non-seekable resources differently,
|
||||
overriding this might speed up opening certain files at the cost of losing some
|
||||
features (e.g. accurate seeking).
|
||||
|
||||
@item pkt_size
|
||||
Set the maximum packet size used for file I/O. A smaller value may reduce
|
||||
memory usage. A higher value may increase throughput especially with networked
|
||||
filesystems.
|
||||
|
||||
For reading, if explicitly set, it overrides the default internal buffer size
|
||||
(32 KB) and limits the maximum amount of data read per operation.
|
||||
|
||||
For writing, this sets the size of each write operation. The default is 256 KB
|
||||
for regular files, 32 KB otherwise.
|
||||
@end table
|
||||
|
||||
@section ftp
|
||||
@@ -417,6 +406,26 @@ Gophers protocol.
|
||||
|
||||
The Gopher protocol with TLS encapsulation.
|
||||
|
||||
@section hls
|
||||
|
||||
Read Apple HTTP Live Streaming compliant segmented stream as
|
||||
a uniform one. The M3U8 playlists describing the segments can be
|
||||
remote HTTP resources or local files, accessed using the standard
|
||||
file protocol.
|
||||
The nested protocol is declared by specifying
|
||||
"+@var{proto}" after the hls URI scheme name, where @var{proto}
|
||||
is either "file" or "http".
|
||||
|
||||
@example
|
||||
hls+http://host/path/to/remote/resource.m3u8
|
||||
hls+file://path/to/local/resource.m3u8
|
||||
@end example
|
||||
|
||||
Using this protocol is discouraged - the hls demuxer should work
|
||||
just as well (if not, please report the issues) and is more complete.
|
||||
To use the hls demuxer instead, simply use the direct URLs to the
|
||||
m3u8 files.
|
||||
|
||||
@section http
|
||||
|
||||
HTTP (Hyper Text Transfer Protocol).
|
||||
@@ -453,28 +462,6 @@ Set the Referer header. Include 'Referer: URL' header in HTTP request.
|
||||
@item multiple_requests
|
||||
Use persistent connections if set to 1, default is 0.
|
||||
|
||||
@item request_size
|
||||
Limit the size of requests made. This is useful for some pathological servers
|
||||
that throttle unbounded range requests, as well as when expecting to seek
|
||||
frequently. Disabled (set to 0) by default.
|
||||
|
||||
Note that if enabling this option, it's strongly recommended to also enable
|
||||
the @option{multiple_requests} option, as well as setting
|
||||
@option{short_seek_size} to the same value or higher. Doing so allows FFmpeg
|
||||
to reuse a single HTTP connection wherever possible.
|
||||
|
||||
@item initial_request_size
|
||||
Limit the size of initial requests. Similar to @code{request_size}, but only
|
||||
used during initial format parsing. Useful for formats like MXF or MOV that
|
||||
require frequent seeks during header parsing. Lasts until the demuxer makes a
|
||||
read request larger than this size (without a seek in between), after which
|
||||
the implementation will continue using requests as usual. Disabled (set to 0)
|
||||
by default.
|
||||
|
||||
Note that if enabling this option, it's strongly recommended to also enable
|
||||
the @option{multiple_requests} option, as well as setting
|
||||
@option{short_seek_size} to the same value or higher.
|
||||
|
||||
@item post_data
|
||||
Set custom HTTP post data.
|
||||
|
||||
@@ -999,11 +986,6 @@ Set TCP_NODELAY to disable Nagle's algorithm. Default value is 0.
|
||||
|
||||
@emph{Remark: Writing to the socket is currently not optimized to minimize system calls and reduces the efficiency / effect of TCP_NODELAY.}
|
||||
|
||||
@item tcp_keepalive=@var{1|0}
|
||||
Enable the TCP keepalive mechanism to detect dead peers and help maintain long-lived idle connections. Default value is 0.
|
||||
|
||||
Only the basic keepalive option (SO_KEEPALIVE) can be enabled or disabled. Platform-specific tuning parameters such as TCP_KEEPIDLE, TCP_KEEPINTVL, or TCP_KEEPCNT are not configurable and will use the operating system's default values.
|
||||
|
||||
@end table
|
||||
|
||||
For example to read with @command{ffplay} a multimedia resource named
|
||||
@@ -1175,13 +1157,9 @@ rtp://@var{hostname}[:@var{port}][?@var{options}]
|
||||
@var{port} specifies the RTP port to use.
|
||||
|
||||
@var{options} contains a list of &-separated options of the form
|
||||
@var{key}=@var{val}. Standard percent-encoding (and using the plus sign for
|
||||
space) can be used to escape keys and values.
|
||||
@var{key}=@var{val}.
|
||||
|
||||
Options can also can be specified via command line options (or in code via
|
||||
@code{AVOption}s).
|
||||
|
||||
The list of supported options follows.
|
||||
The following URL options are supported:
|
||||
|
||||
@table @option
|
||||
|
||||
@@ -1191,12 +1169,10 @@ Set the TTL (Time-To-Live) value (for multicast only).
|
||||
@item rtcpport=@var{n}
|
||||
Set the remote RTCP port to @var{n}.
|
||||
|
||||
@item localport, local_rtpport, localrtpport=@var{n}
|
||||
@item localrtpport=@var{n}
|
||||
Set the local RTP port to @var{n}.
|
||||
|
||||
Using the localport option name is deprecated and should not be used.
|
||||
|
||||
@item local_rtcpport, localrtcpport=@var{n}'
|
||||
@item localrtcpport=@var{n}'
|
||||
Set the local RTCP port to @var{n}.
|
||||
|
||||
@item pkt_size=@var{n}
|
||||
@@ -1219,6 +1195,12 @@ List disallowed (blocked) source IP addresses.
|
||||
Send packets to the source address of the latest received packet (if
|
||||
set to 1) or to a default remote address (if set to 0).
|
||||
|
||||
@item localport=@var{n}
|
||||
Set the local RTP port to @var{n}.
|
||||
|
||||
This is a deprecated option. Instead, @option{localrtpport} should be
|
||||
used.
|
||||
|
||||
@item localaddr=@var{addr}
|
||||
Local IP address of a network interface used for sending packets or joining
|
||||
multicast groups.
|
||||
@@ -1552,15 +1534,7 @@ The accepted URL syntax is:
|
||||
sctp://@var{host}:@var{port}[?@var{options}]
|
||||
@end example
|
||||
|
||||
@var{options} contains a list of &-separated options of the form
|
||||
@var{key}=@var{val}. Standard percent-encoding (and using the plus sign for
|
||||
space) can be used to escape keys and values.
|
||||
|
||||
Options can also can be specified via command line options (or in code via
|
||||
@code{AVOption}s).
|
||||
|
||||
The list of supported options follows.
|
||||
|
||||
The protocol accepts the following options:
|
||||
@table @option
|
||||
@item listen
|
||||
If set to any value, listen for an incoming connection. Outgoing connection is done by default.
|
||||
@@ -1579,13 +1553,18 @@ srt://@var{hostname}:@var{port}[?@var{options}]
|
||||
@end example
|
||||
|
||||
@var{options} contains a list of &-separated options of the form
|
||||
@var{key}=@var{val}. Standard percent-encoding (and using the plus sign for
|
||||
space) can be used to escape keys and values.
|
||||
@var{key}=@var{val}.
|
||||
|
||||
Options can also can be specified via command line options (or in code via
|
||||
@code{AVOption}s).
|
||||
or
|
||||
|
||||
The list of supported options follows.
|
||||
@example
|
||||
@var{options} srt://@var{hostname}:@var{port}
|
||||
@end example
|
||||
|
||||
@var{options} contains a list of '-@var{key} @var{val}'
|
||||
options.
|
||||
|
||||
This protocol accepts the following options.
|
||||
|
||||
@table @option
|
||||
@item connect_timeout=@var{milliseconds}
|
||||
@@ -1938,11 +1917,7 @@ tcp://@var{hostname}:@var{port}[?@var{options}]
|
||||
@end example
|
||||
|
||||
@var{options} contains a list of &-separated options of the form
|
||||
@var{key}=@var{val}. Standard percent-encoding (and using the plus sign for
|
||||
space) can be used to escape keys and values.
|
||||
|
||||
Options can also can be specified via command line options (or in code via
|
||||
@code{AVOption}s).
|
||||
@var{key}=@var{val}.
|
||||
|
||||
The list of supported options follows.
|
||||
|
||||
@@ -1997,14 +1972,8 @@ The required syntax for a TLS/SSL url is:
|
||||
tls://@var{hostname}:@var{port}[?@var{options}]
|
||||
@end example
|
||||
|
||||
@var{options} contains a list of &-separated options of the form
|
||||
@var{key}=@var{val}. Standard percent-encoding (and using the plus sign for
|
||||
space) can be used to escape keys and values.
|
||||
|
||||
Options can also can be specified via command line options (or in code via
|
||||
@code{AVOption}s).
|
||||
|
||||
The list of supported options follows.
|
||||
The following parameters can be set via command line options
|
||||
(or in code via @code{AVOption}s):
|
||||
|
||||
@table @option
|
||||
|
||||
@@ -2015,7 +1984,7 @@ need to be specified for verification to work, but not all libraries and
|
||||
setups have defaults built in.
|
||||
The file must be in OpenSSL PEM format.
|
||||
|
||||
@item tls_verify, verify=@var{1|0}
|
||||
@item tls_verify=@var{1|0}
|
||||
If enabled, try to verify the peer that we are communicating with.
|
||||
Note, if using OpenSSL, this currently only makes sure that the
|
||||
peer certificate is signed by one of the root certificates in the CA
|
||||
@@ -2059,94 +2028,6 @@ To play back a stream from the TLS/SSL server using @command{ffplay}:
|
||||
ffplay tls://@var{hostname}:@var{port}
|
||||
@end example
|
||||
|
||||
@section dtls
|
||||
|
||||
Datagram Transport Layer Security (DTLS)
|
||||
|
||||
The required syntax for a DTLS URL is:
|
||||
@example
|
||||
dtls://@var{hostname}:@var{port}[?@var{options}]
|
||||
@end example
|
||||
|
||||
@var{options} contains a list of &-separated options of the form
|
||||
@var{key}=@var{val}. Standard percent-encoding (and using the plus sign for
|
||||
space) can be used to escape keys and values.
|
||||
|
||||
Options can also can be specified via command line options (or in code via
|
||||
@code{AVOption}s).
|
||||
|
||||
DTLS shares most options with TLS, but operates over UDP instead of TCP.
|
||||
|
||||
The list of supported options follows.
|
||||
|
||||
@table @option
|
||||
|
||||
@item ca_file, cafile=@var{filename}
|
||||
A file containing certificate authority (CA) root certificates to treat
|
||||
as trusted. If the linked TLS library contains a default this might not
|
||||
need to be specified for verification to work, but not all libraries and
|
||||
setups have defaults built in.
|
||||
The file must be in OpenSSL PEM format.
|
||||
|
||||
@item tls_verify, verify=@var{1|0}
|
||||
If enabled, try to verify the peer that we are communicating with.
|
||||
Note, if using OpenSSL, this currently only makes sure that the
|
||||
peer certificate is signed by one of the root certificates in the CA
|
||||
database, but it does not validate that the certificate actually
|
||||
matches the host name we are trying to connect to.
|
||||
|
||||
This is disabled by default since it requires a CA database to be
|
||||
provided by the caller in many cases.
|
||||
|
||||
@item cert_file, cert=@var{filename}
|
||||
A file containing a certificate to use in the handshake with the peer.
|
||||
(When operating as server, in listen mode, this is more often required
|
||||
by the peer, while client certificates only are mandated in certain
|
||||
setups.)
|
||||
|
||||
@item key_file, key=@var{filename}
|
||||
A file containing the private key for the certificate.
|
||||
|
||||
@item cert_pem=@var{string}
|
||||
Certificate PEM string
|
||||
|
||||
@item key_pem=@var{string}
|
||||
Private key PEM string
|
||||
|
||||
@item listen=@var{1|0}
|
||||
If enabled, listen for connections on the provided port, and assume
|
||||
the server role in the handshake instead of the client role.
|
||||
|
||||
@item mtu=@var{size}
|
||||
Set the Maximum Transmission Unit (MTU) for DTLS packets.
|
||||
|
||||
@item use_srtp=@var{1|0}
|
||||
Enable the use_srtp DTLS extension.
|
||||
This is used in WebRTC applications to establish SRTP encryption keys
|
||||
through the DTLS handshake. Default is disabled.
|
||||
|
||||
@item external_sock=@var{1|0}
|
||||
Use an external socket instead of creating a new one.
|
||||
This option only makes sense to pass when interacting with the code via
|
||||
API, enabling this from CLI will cause immediate failure.
|
||||
Default is disabled.
|
||||
|
||||
@end table
|
||||
|
||||
Example command lines:
|
||||
|
||||
To create a DTLS server:
|
||||
|
||||
@example
|
||||
ffmpeg -listen 1 -i dtls://@var{hostname}:@var{port} @var{output}
|
||||
@end example
|
||||
|
||||
To create a DTLS client and send data to server:
|
||||
|
||||
@example
|
||||
ffmpeg -i @var{input} -f @var{format} dtls://@var{hostname}:@var{port}
|
||||
@end example
|
||||
|
||||
@section udp
|
||||
|
||||
User Datagram Protocol.
|
||||
@@ -2156,12 +2037,7 @@ The required syntax for an UDP URL is:
|
||||
udp://@var{hostname}:@var{port}[?@var{options}]
|
||||
@end example
|
||||
|
||||
@var{options} contains a list of &-separated options of the form
|
||||
@var{key}=@var{val}. Standard percent-encoding (and using the plus sign for
|
||||
space) can be used to escape keys and values.
|
||||
|
||||
Options can also can be specified via command line options (or in code via
|
||||
@code{AVOption}s).
|
||||
@var{options} contains a list of &-separated options of the form @var{key}=@var{val}.
|
||||
|
||||
In case threading is enabled on the system, a circular buffer is used
|
||||
to store the incoming data, which allows one to reduce loss of data due to
|
||||
@@ -2200,9 +2076,6 @@ Explicitly allow or disallow reusing UDP sockets.
|
||||
@item ttl=@var{ttl}
|
||||
Set the time to live value (for multicast only).
|
||||
|
||||
@item dscp=@var{dscp}
|
||||
Set the 6-bit DSCP field for outgoing packets.
|
||||
|
||||
@item connect=@var{1|0}
|
||||
Initialize the UDP socket with @code{connect()}. In this case, the
|
||||
destination address can't be changed with ff_udp_set_remote_url later.
|
||||
@@ -2284,17 +2157,6 @@ The following parameters can be set via command line options
|
||||
Timeout in ms.
|
||||
@item listen
|
||||
Create the Unix socket in listening mode.
|
||||
@item type
|
||||
Select socket type.
|
||||
@table @samp
|
||||
@item stream Corresponds to SOCK_STREAM (reliable stream-oriented)
|
||||
@item datagram Corresponds to SOCK_DGRAM (unreliable packet-oriented)
|
||||
@item seqpacket Corresponds to SOCK_SEQPACKET (reliable packet-oriented)
|
||||
@end table
|
||||
@item pkt_size
|
||||
Maximum packet size for packet-oriented sockets (SOCK_DGRAM and
|
||||
SOCK_SEQPACKET). If greater than zero, this value is used as
|
||||
@code{max_packet_size}. Ignored for SOCK_STREAM. Default is @code{0}.
|
||||
@end table
|
||||
|
||||
@section zmq
|
||||
|
||||
@@ -68,10 +68,6 @@ Select full chroma input.
|
||||
|
||||
@item bitexact
|
||||
Enable bitexact output.
|
||||
|
||||
@item unstable
|
||||
Allow the use of experimental new code. May subtly affect the output or even
|
||||
produce wrong results. For testing only.
|
||||
@end table
|
||||
|
||||
@item srcw @var{(API only)}
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ This overall approach has a considerable number of benefits:
|
||||
multiple levels of complicated, interwoven format handling code that is
|
||||
legacy swscale.
|
||||
|
||||
2. Because most of the brains lives inside the powerful optimizer, we get
|
||||
2. Because most of the brains lives inside the the powerful optimizer, we get
|
||||
fast paths "for free" for any suitable format conversion, rather than having
|
||||
to enumerate them one by one. SIMD code itself can be written in a very
|
||||
general way and does need to be tied to specific pixel formats - subsequent
|
||||
|
||||
+1
-2
@@ -5,8 +5,6 @@ OBJS-$(HAVE_VFP) += $(VFP-OBJS) $(VFP-OBJS-yes)
|
||||
OBJS-$(HAVE_NEON) += $(NEON-OBJS) $(NEON-OBJS-yes)
|
||||
OBJS-$(HAVE_SVE) += $(SVE-OBJS) $(SVE-OBJS-yes)
|
||||
OBJS-$(HAVE_SVE2) += $(SVE2-OBJS) $(SVE2-OBJS-yes)
|
||||
OBJS-$(HAVE_SME) += $(SME-OBJS) $(SME-OBJS-yes)
|
||||
OBJS-$(HAVE_SME2) += $(SME2-OBJS) $(SME2-OBJS-yes)
|
||||
|
||||
OBJS-$(HAVE_MIPSFPU) += $(MIPSFPU-OBJS) $(MIPSFPU-OBJS-yes)
|
||||
OBJS-$(HAVE_MIPSDSP) += $(MIPSDSP-OBJS) $(MIPSDSP-OBJS-yes)
|
||||
@@ -25,4 +23,5 @@ OBJS-$(HAVE_RV_ZVBB) += $(RVVB-OBJS) $(RVVB-OBJS-yes)
|
||||
|
||||
OBJS-$(HAVE_SIMD128) += $(SIMD128-OBJS) $(SIMD128-OBJS-yes)
|
||||
|
||||
OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)
|
||||
OBJS-$(HAVE_X86ASM) += $(X86ASM-OBJS) $(X86ASM-OBJS-yes)
|
||||
|
||||
+35
-49
@@ -12,23 +12,14 @@ endif
|
||||
|
||||
ifndef SUBDIR
|
||||
|
||||
LINK = $(LD) $(1)
|
||||
|
||||
ifeq ($(LD),$(CC))
|
||||
ifneq ($(CXX),)
|
||||
LDXX := $(CXX)
|
||||
LINK = $(if $(filter -lstdc++,$(1)),$(LDXX) $(filter-out -lstdc++,$(1)),$(LD) $(1))
|
||||
endif
|
||||
endif
|
||||
|
||||
BIN2CEXE = ffbuild/bin2c$(HOSTEXESUF)
|
||||
BIN2C = $(BIN2CEXE)
|
||||
|
||||
ifndef V
|
||||
Q = @
|
||||
ECHO = printf "$(1)\t%s\n" $(2)
|
||||
BRIEF = CC CXX OBJCC HOSTCC HOSTLD AS X86ASM AR LD LDXX STRIP CP WINDRES GLSLC NVCC BIN2C METALCC METALLIB
|
||||
SILENT = DEPCC DEPCXX DEPHOSTCC DEPAS DEPX86ASM RANLIB RM
|
||||
BRIEF = CC CXX OBJCC HOSTCC HOSTLD AS X86ASM AR LD STRIP CP WINDRES NVCC BIN2C METALCC METALLIB
|
||||
SILENT = DEPCC DEPHOSTCC DEPAS DEPX86ASM RANLIB RM
|
||||
|
||||
MSG = $@
|
||||
M = @$(call ECHO,$(TAG),$@);
|
||||
@@ -51,7 +42,7 @@ OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)
|
||||
ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
|
||||
# Use PREPEND here so that later (target-dependent) additions to CPPFLAGS
|
||||
# end up in CXXFLAGS.
|
||||
$(call PREPEND,CXXFLAGS, CPPFLAGS)
|
||||
$(call PREPEND,CXXFLAGS, CPPFLAGS CFLAGS)
|
||||
X86ASMFLAGS += $(IFLAGS:%=%/) -I$(<D)/ -Pconfig.asm
|
||||
|
||||
HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
|
||||
@@ -68,7 +59,6 @@ COMPILE_S = $(call COMPILE,AS)
|
||||
COMPILE_M = $(call COMPILE,OBJCC)
|
||||
COMPILE_X86ASM = $(call COMPILE,X86ASM)
|
||||
COMPILE_HOSTC = $(call COMPILE,HOSTCC)
|
||||
COMPILE_GLSLC = $(call COMPILE,GLSLC)
|
||||
COMPILE_NVCC = $(call COMPILE,NVCC)
|
||||
COMPILE_MMI = $(call COMPILE,CC,MMIFLAGS)
|
||||
COMPILE_MSA = $(call COMPILE,CC,MSAFLAGS)
|
||||
@@ -125,26 +115,6 @@ COMPILE_LASX = $(call COMPILE,CC,LASXFLAGS)
|
||||
$(BIN2CEXE): ffbuild/bin2c_host.o
|
||||
$(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTEXTRALIBS)
|
||||
|
||||
RUN_BIN2C = $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
|
||||
RUN_GZIP = $(M)gzip -nc9 $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) >$@
|
||||
RUN_MINIFY = $(M)sed 's!/\\*.*\\*/!!g' $< | tr '\n' ' ' | tr -s ' ' | sed 's/^ //; s/ $$//' > $@
|
||||
%.gz: TAG = GZIP
|
||||
%.min: TAG = MINIFY
|
||||
|
||||
%.spv: %.glsl
|
||||
$(COMPILE_GLSLC)
|
||||
|
||||
ifdef CONFIG_SHADER_COMPRESSION
|
||||
%.spv.gz: %.spv
|
||||
$(RUN_GZIP)
|
||||
|
||||
%.spv.c: %.spv.gz $(BIN2CEXE)
|
||||
$(RUN_BIN2C)
|
||||
else
|
||||
%.spv.c: %.spv $(BIN2CEXE)
|
||||
$(RUN_BIN2C)
|
||||
endif
|
||||
|
||||
%.metal.air: %.metal
|
||||
$(METALCC) $< -o $@
|
||||
|
||||
@@ -152,46 +122,61 @@ endif
|
||||
$(METALLIB) --split-module-without-linking $< -o $@
|
||||
|
||||
%.metallib.c: %.metallib $(BIN2CEXE)
|
||||
$(RUN_BIN2C)
|
||||
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
|
||||
|
||||
%.ptx: %.cu $(SRC_PATH)/compat/cuda/cuda_runtime.h
|
||||
$(COMPILE_NVCC)
|
||||
|
||||
ifdef CONFIG_SHADER_COMPRESSION
|
||||
ifdef CONFIG_PTX_COMPRESSION
|
||||
%.ptx.gz: TAG = GZIP
|
||||
%.ptx.gz: %.ptx
|
||||
$(RUN_GZIP)
|
||||
$(M)gzip -nc9 $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) >$@
|
||||
|
||||
%.ptx.c: %.ptx.gz $(BIN2CEXE)
|
||||
$(RUN_BIN2C)
|
||||
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
|
||||
else
|
||||
%.ptx.c: %.ptx $(BIN2CEXE)
|
||||
$(RUN_BIN2C)
|
||||
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
|
||||
endif
|
||||
|
||||
# 1) Preprocess CSS to a minified version
|
||||
%.css.min: TAG = SED
|
||||
%.css.min: %.css
|
||||
$(RUN_MINIFY)
|
||||
$(M)sed 's!/\\*.*\\*/!!g' $< \
|
||||
| tr '\n' ' ' \
|
||||
| tr -s ' ' \
|
||||
| sed 's/^ //; s/ $$//' \
|
||||
> $@
|
||||
|
||||
ifdef CONFIG_RESOURCE_COMPRESSION
|
||||
|
||||
# 2) Gzip the minified CSS
|
||||
%.css.min.gz: TAG = GZIP
|
||||
%.css.min.gz: %.css.min
|
||||
$(RUN_GZIP)
|
||||
$(M)gzip -nc9 $< > $@
|
||||
|
||||
# 3) Convert the gzipped CSS to a .c array
|
||||
%.css.c: %.css.min.gz $(BIN2CEXE)
|
||||
$(RUN_BIN2C)
|
||||
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
|
||||
|
||||
# 4) Gzip the HTML file (no minification needed)
|
||||
%.html.gz: TAG = GZIP
|
||||
%.html.gz: %.html
|
||||
$(RUN_GZIP)
|
||||
$(M)gzip -nc9 $< > $@
|
||||
|
||||
# 5) Convert the gzipped HTML to a .c array
|
||||
%.html.c: %.html.gz $(BIN2CEXE)
|
||||
$(RUN_BIN2C)
|
||||
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
|
||||
|
||||
else # NO COMPRESSION
|
||||
|
||||
# 2) Convert the minified CSS to a .c array
|
||||
%.css.c: %.css.min $(BIN2CEXE)
|
||||
$(RUN_BIN2C)
|
||||
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
|
||||
|
||||
# 3) Convert the plain HTML to a .c array
|
||||
%.html.c: %.html $(BIN2CEXE)
|
||||
$(RUN_BIN2C)
|
||||
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
|
||||
endif
|
||||
|
||||
clean::
|
||||
@@ -243,11 +228,12 @@ ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)
|
||||
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
|
||||
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
|
||||
HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
|
||||
SPVOBJS = $(filter %.spv.o,$(OBJS))
|
||||
PTXOBJS = $(filter %.ptx.o,$(OBJS))
|
||||
RESOURCEOBJS = $(filter %.css.o %.html.o,$(OBJS))
|
||||
$(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
|
||||
checkheaders: $(HOBJS)
|
||||
.SECONDARY: $(HOBJS:.o=.c) $(SPVOBJS:.o=.c) $(SPVOBJS:.o=.gz) $(SPVOBJS:.o=) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=)
|
||||
.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=) $(RESOURCEOBJS:.o=.c) $(RESOURCEOBJS:%.css.o=%.css.min) $(RESOURCEOBJS:%.css.o=%.css.min.gz) $(RESOURCEOBJS:%.html.o=%.html.gz) $(RESOURCEOBJS:.o=)
|
||||
|
||||
alltools: $(TOOLS)
|
||||
|
||||
$(HOSTOBJS): %.o: %.c
|
||||
@@ -266,7 +252,7 @@ $(TOOLOBJS): | tools
|
||||
|
||||
OUTDIRS := $(OUTDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SHLIBOBJS) $(STLIBOBJS) $(TESTOBJS))
|
||||
|
||||
CLEANSUFFIXES = *.d *.gcda *.gcno *.h.c *.ho *.map *.o *.objs *.pc *.ptx *.ptx.gz *.ptx.c *.spv *.spv.gz *.spv.c *.ver *.version *.html.gz *.html.c *.css.min.gz *.css.min *.css.c *$(DEFAULT_X86ASMD).asm *~ *.ilk *.pdb
|
||||
CLEANSUFFIXES = *.d *.gcda *.gcno *.h.c *.ho *.map *.o *.objs *.pc *.ptx *.ptx.gz *.ptx.c *.ver *.version *.html.gz *.html.c *.css.gz *.css.c *$(DEFAULT_X86ASMD).asm *~ *.ilk *.pdb
|
||||
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
|
||||
|
||||
define RULES
|
||||
@@ -276,4 +262,4 @@ endef
|
||||
|
||||
$(eval $(RULES))
|
||||
|
||||
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SHLIBOBJS:.o=.d) $(STLIBOBJS:.o=.d) $(SPVOBJS:.spv.o=.d)) $(OBJS:.o=$(DEFAULT_X86ASMD).d)
|
||||
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SHLIBOBJS:.o=.d) $(STLIBOBJS:.o=.d)) $(OBJS:.o=$(DEFAULT_X86ASMD).d)
|
||||
|
||||
+3
-7
@@ -55,12 +55,8 @@ $(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
|
||||
|
||||
$(LIBOBJS): CPPFLAGS += -DBUILDING_$(NAME)
|
||||
|
||||
$(NAME)LINK_EXE_ARGS = $(LDFLAGS) $(LDEXEFLAGS)
|
||||
$(NAME)LINK_SO_ARGS = $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS)
|
||||
$(NAME)LINK_EXTRA = $(FFEXTRALIBS)
|
||||
|
||||
$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
|
||||
$$(call LINK,$$(call $(NAME)LINK_EXE_ARGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $$(call $(NAME)LINK_EXTRA) $$(EXTRALIBS-$$(*F)) $$(ELIBS))
|
||||
$$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(EXTRALIBS-$$(*F)) $$(ELIBS)
|
||||
|
||||
$(SUBDIR)lib$(NAME).version: $(SUBDIR)version.h $(SUBDIR)version_major.h | $(SUBDIR)
|
||||
$$(M) $$(SRC_PATH)/ffbuild/libversion.sh $(NAME) $$^ > $$@
|
||||
@@ -78,9 +74,9 @@ $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SHLIBOBJS) $(SUBDIR)lib$(NAME).ver
|
||||
$(SLIB_CREATE_DEF_CMD)
|
||||
ifeq ($(RESPONSE_FILES),yes)
|
||||
$(Q)echo $$(filter %.o,$$^) > $$@.objs
|
||||
$$(call LINK,$$(call $(NAME)LINK_SO_ARGS) $$(LD_O) @$$@.objs $$(call $(NAME)LINK_EXTRA))
|
||||
$$(LD) $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS) $$(LD_O) @$$@.objs $(FFEXTRALIBS)
|
||||
else
|
||||
$$(call LINK,$$(call $(NAME)LINK_SO_ARGS) $$(LD_O) $$(filter %.o,$$^) $$(call $(NAME)LINK_EXTRA))
|
||||
$$(LD) $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
|
||||
endif
|
||||
$(SLIB_EXTRA_CMD)
|
||||
-$(RM) $$@.objs
|
||||
|
||||
@@ -36,7 +36,6 @@ OBJS-ffmpeg += \
|
||||
fftools/textformat/tw_buffer.o \
|
||||
fftools/textformat/tw_stdout.o \
|
||||
$(OBJS-resman) \
|
||||
$(RESOBJS) \
|
||||
|
||||
OBJS-ffprobe += \
|
||||
fftools/textformat/avtextformat.o \
|
||||
@@ -51,7 +50,6 @@ OBJS-ffprobe += \
|
||||
fftools/textformat/tw_buffer.o \
|
||||
fftools/textformat/tw_stdout.o \
|
||||
|
||||
OBJS-ffmpeg += $(COMPAT_OBJS:%=compat/%)
|
||||
OBJS-ffplay += fftools/ffplay_renderer.o
|
||||
|
||||
define DOFFTOOL
|
||||
|
||||
+5
-100
@@ -263,7 +263,7 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
arg_allocated = read_file_to_string(arg);
|
||||
arg_allocated = file_read(arg);
|
||||
if (!arg_allocated) {
|
||||
av_log(NULL, AV_LOG_FATAL,
|
||||
"Error reading the value for option '%s' from file: %s\n",
|
||||
@@ -275,7 +275,7 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
|
||||
}
|
||||
|
||||
if (po->flags & OPT_FLAG_SPEC) {
|
||||
const char *p = strchr(opt, ':');
|
||||
char *p = strchr(opt, ':');
|
||||
char *str;
|
||||
|
||||
sol = dst;
|
||||
@@ -962,7 +962,8 @@ FILE *get_preset_file(char *filename, size_t filename_size,
|
||||
datadir, desired_size, sizeof *datadir);
|
||||
if (new_datadir) {
|
||||
datadir = new_datadir;
|
||||
strcpy(datadir + datadir_len, "/ffpresets");
|
||||
datadir[datadir_len] = 0;
|
||||
strncat(datadir, "/ffpresets", desired_size - 1 - datadir_len);
|
||||
base[2] = datadir;
|
||||
}
|
||||
}
|
||||
@@ -1349,77 +1350,6 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned stream_group_specifier_match(const StreamSpecifier *ss,
|
||||
const AVFormatContext *s, const AVStreamGroup *stg,
|
||||
void *logctx)
|
||||
{
|
||||
int start_stream_group = 0, nb_stream_groups;
|
||||
int nb_matched = 0;
|
||||
|
||||
if (ss->idx >= 0)
|
||||
return 0;
|
||||
|
||||
switch (ss->stream_list) {
|
||||
case STREAM_LIST_STREAM_ID:
|
||||
case STREAM_LIST_ALL:
|
||||
case STREAM_LIST_PROGRAM:
|
||||
return 0;
|
||||
case STREAM_LIST_GROUP_ID:
|
||||
// <n-th> stream with given ID makes no sense and should be impossible to request
|
||||
av_assert0(ss->idx < 0);
|
||||
// return early if we know for sure the stream does not match
|
||||
if (stg->id != ss->list_id)
|
||||
return 0;
|
||||
start_stream_group = stg->index;
|
||||
nb_stream_groups = stg->index + 1;
|
||||
break;
|
||||
case STREAM_LIST_GROUP_IDX:
|
||||
start_stream_group = ss->list_id >= 0 ? 0 : stg->index;
|
||||
nb_stream_groups = stg->index + 1;
|
||||
break;
|
||||
default: av_assert0(0);
|
||||
}
|
||||
|
||||
for (int i = start_stream_group; i < nb_stream_groups; i++) {
|
||||
const AVStreamGroup *candidate = s->stream_groups[i];
|
||||
|
||||
if (ss->meta_key) {
|
||||
const AVDictionaryEntry *tag = av_dict_get(candidate->metadata,
|
||||
ss->meta_key, NULL, 0);
|
||||
|
||||
if (!tag)
|
||||
continue;
|
||||
if (ss->meta_val && strcmp(tag->value, ss->meta_val))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ss->usable_only) {
|
||||
switch (candidate->type) {
|
||||
case AV_STREAM_GROUP_PARAMS_TILE_GRID: {
|
||||
const AVStreamGroupTileGrid *tg = candidate->params.tile_grid;
|
||||
if (!tg->coded_width || !tg->coded_height || !tg->nb_tiles ||
|
||||
!tg->width || !tg->height || !tg->nb_tiles)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (ss->disposition &&
|
||||
(candidate->disposition & ss->disposition) != ss->disposition)
|
||||
continue;
|
||||
|
||||
if (stg == candidate)
|
||||
return ss->list_id < 0 || ss->list_id == nb_matched;
|
||||
|
||||
nb_matched++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id,
|
||||
AVFormatContext *s, AVStream *st, const AVCodec *codec,
|
||||
AVDictionary **dst, AVDictionary **opts_used)
|
||||
@@ -1568,7 +1498,7 @@ double get_rotation(const int32_t *displaymatrix)
|
||||
}
|
||||
|
||||
/* read file contents into a string */
|
||||
char *read_file_to_string(const char *filename)
|
||||
char *file_read(const char *filename)
|
||||
{
|
||||
AVIOContext *pb = NULL;
|
||||
int ret = avio_open(&pb, filename, AVIO_FLAG_READ);
|
||||
@@ -1612,28 +1542,3 @@ int check_avoptions(AVDictionary *m)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dump_dictionary(void *ctx, const AVDictionary *m,
|
||||
const char *name, const char *indent,
|
||||
int log_level)
|
||||
{
|
||||
const AVDictionaryEntry *tag = NULL;
|
||||
|
||||
if (!m)
|
||||
return;
|
||||
|
||||
av_log(ctx, log_level, "%s%s:\n", indent, name);
|
||||
while ((tag = av_dict_iterate(m, tag))) {
|
||||
const char *p = tag->value;
|
||||
av_log(ctx, log_level, "%s %-16s: ", indent, tag->key);
|
||||
while (*p) {
|
||||
size_t len = strcspn(p, "\x8\xa\xb\xc\xd");
|
||||
av_log(ctx, log_level, "%.*s", (int)(FFMIN(255, len)), p);
|
||||
p += len;
|
||||
if (*p == 0xd) av_log(ctx, log_level, " ");
|
||||
if (*p == 0xa) av_log(ctx, log_level, "\n%s %-16s: ", indent, "");
|
||||
if (*p) p++;
|
||||
}
|
||||
av_log(ctx, log_level, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
+1
-13
@@ -158,10 +158,6 @@ unsigned stream_specifier_match(const StreamSpecifier *ss,
|
||||
const AVFormatContext *s, const AVStream *st,
|
||||
void *logctx);
|
||||
|
||||
unsigned stream_group_specifier_match(const StreamSpecifier *ss,
|
||||
const AVFormatContext *s, const AVStreamGroup *stg,
|
||||
void *logctx);
|
||||
|
||||
void stream_specifier_uninit(StreamSpecifier *ss);
|
||||
|
||||
typedef struct SpecifierOpt {
|
||||
@@ -539,7 +535,7 @@ void *allocate_array_elem(void *array, size_t elem_size, int *nb_elems);
|
||||
double get_rotation(const int32_t *displaymatrix);
|
||||
|
||||
/* read file contents into a string */
|
||||
char *read_file_to_string(const char *filename);
|
||||
char *file_read(const char *filename);
|
||||
|
||||
/* Remove keys in dictionary b from dictionary a */
|
||||
void remove_avoptions(AVDictionary **a, AVDictionary *b);
|
||||
@@ -549,12 +545,4 @@ int check_avoptions(AVDictionary *m);
|
||||
|
||||
int cmdutils_isalnum(char c);
|
||||
|
||||
/**
|
||||
* This does the same as libavformat/dump.c corresponding function
|
||||
* and should probably be kept in sync when the other one changes.
|
||||
*/
|
||||
void dump_dictionary(void *ctx, const AVDictionary *m,
|
||||
const char *name, const char *indent,
|
||||
int log_level);
|
||||
|
||||
#endif /* FFTOOLS_CMDUTILS_H */
|
||||
|
||||
+4
-25
@@ -78,9 +78,6 @@
|
||||
#include "libavdevice/avdevice.h"
|
||||
|
||||
#include "cmdutils.h"
|
||||
#if CONFIG_MEDIACODEC
|
||||
#include "compat/android/binder.h"
|
||||
#endif
|
||||
#include "ffmpeg.h"
|
||||
#include "ffmpeg_sched.h"
|
||||
#include "ffmpeg_utils.h"
|
||||
@@ -253,7 +250,7 @@ void term_init(void)
|
||||
/* read a key without blocking */
|
||||
static int read_key(void)
|
||||
{
|
||||
unsigned char ch = -1;
|
||||
unsigned char ch;
|
||||
#if HAVE_TERMIOS_H
|
||||
int n = 1;
|
||||
struct timeval tv;
|
||||
@@ -300,7 +297,7 @@ static int read_key(void)
|
||||
if(kbhit())
|
||||
return(getch());
|
||||
#endif
|
||||
return ch;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int decode_interrupt_cb(void *ctx)
|
||||
@@ -403,7 +400,6 @@ static void frame_data_free(void *opaque, uint8_t *data)
|
||||
{
|
||||
FrameData *fd = (FrameData *)data;
|
||||
|
||||
av_frame_side_data_free(&fd->side_data, &fd->nb_side_data);
|
||||
avcodec_parameters_free(&fd->par_enc);
|
||||
|
||||
av_free(data);
|
||||
@@ -433,8 +429,6 @@ static int frame_data_ensure(AVBufferRef **dst, int writable)
|
||||
|
||||
memcpy(fd, fd_src, sizeof(*fd));
|
||||
fd->par_enc = NULL;
|
||||
fd->side_data = NULL;
|
||||
fd->nb_side_data = 0;
|
||||
|
||||
if (fd_src->par_enc) {
|
||||
int ret = 0;
|
||||
@@ -450,16 +444,6 @@ static int frame_data_ensure(AVBufferRef **dst, int writable)
|
||||
}
|
||||
}
|
||||
|
||||
if (fd_src->nb_side_data) {
|
||||
int ret = clone_side_data(&fd->side_data, &fd->nb_side_data,
|
||||
fd_src->side_data, fd_src->nb_side_data, 0);
|
||||
if (ret < 0) {
|
||||
av_buffer_unref(dst);
|
||||
av_buffer_unref(&src);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
av_buffer_unref(&src);
|
||||
} else {
|
||||
fd->dec.frame_num = UINT64_MAX;
|
||||
@@ -822,6 +806,8 @@ static int check_keyboard_interaction(int64_t cur_time)
|
||||
{
|
||||
int i, key;
|
||||
static int64_t last_time;
|
||||
if (received_nb_signals)
|
||||
return AVERROR_EXIT;
|
||||
/* read_key() returns 0 on EOF */
|
||||
if (cur_time - last_time >= 100000) {
|
||||
key = read_key();
|
||||
@@ -905,9 +891,6 @@ static int transcode(Scheduler *sch)
|
||||
while (!sch_wait(sch, stats_period, &transcode_ts)) {
|
||||
int64_t cur_time= av_gettime_relative();
|
||||
|
||||
if (received_nb_signals)
|
||||
break;
|
||||
|
||||
/* if 'q' pressed, exits */
|
||||
if (stdin_interaction)
|
||||
if (check_keyboard_interaction(cur_time) < 0)
|
||||
@@ -1022,10 +1005,6 @@ int main(int argc, char **argv)
|
||||
goto finish;
|
||||
}
|
||||
|
||||
#if CONFIG_MEDIACODEC
|
||||
android_binder_threadpool_init_if_required();
|
||||
#endif
|
||||
|
||||
current_time = ti = get_benchmark_time_stamps();
|
||||
ret = transcode(sch);
|
||||
if (ret >= 0 && do_benchmark) {
|
||||
|
||||
+5
-59
@@ -136,7 +136,6 @@ typedef struct StreamMap {
|
||||
int disabled; /* 1 is this mapping is disabled by a negative map */
|
||||
int file_index;
|
||||
int stream_index;
|
||||
int group_index;
|
||||
char *linklabel; /* name of an output link, for mapping lavfi outputs */
|
||||
|
||||
ViewSpecifier vs;
|
||||
@@ -258,8 +257,6 @@ typedef struct OptionsContext {
|
||||
SpecifierOptList enc_stats_pre_fmt;
|
||||
SpecifierOptList enc_stats_post_fmt;
|
||||
SpecifierOptList mux_stats_fmt;
|
||||
|
||||
int depth;
|
||||
} OptionsContext;
|
||||
|
||||
enum IFilterFlags {
|
||||
@@ -302,8 +299,6 @@ enum OFilterFlags {
|
||||
// produce 24-bit audio
|
||||
OFILTER_FLAG_AUDIO_24BIT = (1 << 1),
|
||||
OFILTER_FLAG_AUTOSCALE = (1 << 2),
|
||||
OFILTER_FLAG_AUTOROTATE = (1 << 3),
|
||||
OFILTER_FLAG_CROP = (1 << 4),
|
||||
};
|
||||
|
||||
typedef struct OutputFilterOptions {
|
||||
@@ -335,12 +330,6 @@ typedef struct OutputFilterOptions {
|
||||
int height;
|
||||
enum AVColorSpace color_space;
|
||||
enum AVColorRange color_range;
|
||||
enum AVAlphaMode alpha_mode;
|
||||
|
||||
unsigned crop_top;
|
||||
unsigned crop_bottom;
|
||||
unsigned crop_left;
|
||||
unsigned crop_right;
|
||||
|
||||
enum VideoSyncMethod vsync_method;
|
||||
AVRational frame_rate;
|
||||
@@ -349,19 +338,12 @@ typedef struct OutputFilterOptions {
|
||||
int sample_rate;
|
||||
AVChannelLayout ch_layout;
|
||||
|
||||
union {
|
||||
const enum AVPixelFormat *pix_fmts;
|
||||
const enum AVSampleFormat *sample_fmts;
|
||||
};
|
||||
const int *formats;
|
||||
const int *sample_rates;
|
||||
const AVChannelLayout *ch_layouts;
|
||||
const AVRational *frame_rates;
|
||||
const enum AVColorSpace *color_spaces;
|
||||
const enum AVColorRange *color_ranges;
|
||||
const enum AVAlphaMode *alpha_modes;
|
||||
|
||||
AVFrameSideData **side_data;
|
||||
int nb_side_data;
|
||||
|
||||
// for simple filtergraphs only, view specifier passed
|
||||
// along to the decoder
|
||||
@@ -418,11 +400,6 @@ typedef struct FilterGraph {
|
||||
OutputFilter **outputs;
|
||||
int nb_outputs;
|
||||
|
||||
// true when the filtergraph is created internally for
|
||||
// purposes like stream group merging. Meant to be freed
|
||||
// if unbound.
|
||||
int is_internal;
|
||||
|
||||
const char *graph_desc;
|
||||
struct AVBPrint graph_print_buf;
|
||||
} FilterGraph;
|
||||
@@ -512,18 +489,6 @@ typedef struct InputStream {
|
||||
int nb_filters;
|
||||
} InputStream;
|
||||
|
||||
typedef struct InputStreamGroup {
|
||||
const AVClass *class;
|
||||
|
||||
/* parent source */
|
||||
struct InputFile *file;
|
||||
|
||||
int index;
|
||||
|
||||
FilterGraph *fg;
|
||||
AVStreamGroup *stg;
|
||||
} InputStreamGroup;
|
||||
|
||||
typedef struct InputFile {
|
||||
const AVClass *class;
|
||||
|
||||
@@ -545,10 +510,6 @@ typedef struct InputFile {
|
||||
* if new streams appear dynamically during demuxing */
|
||||
InputStream **streams;
|
||||
int nb_streams;
|
||||
|
||||
/* stream groups that ffmpeg is aware of; */
|
||||
InputStreamGroup **stream_groups;
|
||||
int nb_stream_groups;
|
||||
} InputFile;
|
||||
|
||||
enum forced_keyframes_const {
|
||||
@@ -607,8 +568,6 @@ enum {
|
||||
#if FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP
|
||||
KF_FORCE_SOURCE_NO_DROP = 2,
|
||||
#endif
|
||||
// force keyframe if lavfi.scd.time metadata is set
|
||||
KF_FORCE_SCD_METADATA = 3,
|
||||
};
|
||||
|
||||
typedef struct KeyframeForceCtx {
|
||||
@@ -737,9 +696,6 @@ typedef struct FrameData {
|
||||
int64_t wallclock[LATENCY_PROBE_NB];
|
||||
|
||||
AVCodecParameters *par_enc;
|
||||
|
||||
AVFrameSideData **side_data;
|
||||
int nb_side_data;
|
||||
} FrameData;
|
||||
|
||||
extern InputFile **input_files;
|
||||
@@ -813,12 +769,12 @@ int check_avoptions_used(const AVDictionary *opts, const AVDictionary *opts_used
|
||||
int assert_file_overwrite(const char *filename);
|
||||
int find_codec(void *logctx, const char *name,
|
||||
enum AVMediaType type, int encoder, const AVCodec **codec);
|
||||
int parse_and_set_vsync(const char *arg, enum VideoSyncMethod *vsync_var, int file_idx, int st_idx, int is_global);
|
||||
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global);
|
||||
|
||||
int filtergraph_is_simple(const FilterGraph *fg);
|
||||
int fg_create_simple(FilterGraph **pfg,
|
||||
InputStream *ist,
|
||||
char **graph_desc,
|
||||
char *graph_desc,
|
||||
Scheduler *sch, unsigned sched_idx_enc,
|
||||
const OutputFilterOptions *opts);
|
||||
int fg_finalise_bindings(void);
|
||||
@@ -841,11 +797,10 @@ int ofilter_bind_enc(OutputFilter *ofilter,
|
||||
/**
|
||||
* Create a new filtergraph in the global filtergraph list.
|
||||
*
|
||||
* @param graph_desc Pointer to graph description; an av_malloc()ed string, filtergraph
|
||||
* @param graph_desc Graph description; an av_malloc()ed string, filtergraph
|
||||
* takes ownership of it.
|
||||
*/
|
||||
int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch,
|
||||
const OutputFilterOptions *opts);
|
||||
int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch);
|
||||
|
||||
void fg_free(FilterGraph **pfg);
|
||||
|
||||
@@ -972,15 +927,6 @@ void opt_match_per_stream_int64(void *logctx, const SpecifierOptList *sol,
|
||||
void opt_match_per_stream_dbl(void *logctx, const SpecifierOptList *sol,
|
||||
AVFormatContext *fc, AVStream *st, double *out);
|
||||
|
||||
void opt_match_per_stream_group_str(void *logctx, const SpecifierOptList *sol,
|
||||
AVFormatContext *fc, AVStreamGroup *stg, const char **out);
|
||||
void opt_match_per_stream_group_int(void *logctx, const SpecifierOptList *sol,
|
||||
AVFormatContext *fc, AVStreamGroup *stg, int *out);
|
||||
void opt_match_per_stream_group_int64(void *logctx, const SpecifierOptList *sol,
|
||||
AVFormatContext *fc, AVStreamGroup *stg, int64_t *out);
|
||||
void opt_match_per_stream_group_dbl(void *logctx, const SpecifierOptList *sol,
|
||||
AVFormatContext *fc, AVStreamGroup *stg, double *out);
|
||||
|
||||
int view_specifier_parse(const char **pspec, ViewSpecifier *vs);
|
||||
|
||||
int muxer_thread(void *arg);
|
||||
|
||||
@@ -744,14 +744,11 @@ static int packet_decode(DecoderPriv *dp, AVPacket *pkt, AVFrame *frame)
|
||||
while (1) {
|
||||
FrameData *fd;
|
||||
unsigned outputs_mask = 1;
|
||||
unsigned flags = 0;
|
||||
if (!dp->dec.frames_decoded)
|
||||
flags |= AV_CODEC_RECEIVE_FRAME_FLAG_SYNCHRONOUS;
|
||||
|
||||
av_frame_unref(frame);
|
||||
|
||||
update_benchmark(NULL);
|
||||
ret = avcodec_receive_frame_flags(dec, frame, flags);
|
||||
ret = avcodec_receive_frame(dec, frame);
|
||||
update_benchmark("decode_%s %s", type_desc, dp->parent_name);
|
||||
|
||||
if (ret == AVERROR(EAGAIN)) {
|
||||
@@ -1010,7 +1007,7 @@ static int decoder_thread(void *arg)
|
||||
ret = 0;
|
||||
|
||||
err_rate = (dp->dec.frames_decoded || dp->dec.decode_errors) ?
|
||||
(float)dp->dec.decode_errors / (dp->dec.frames_decoded + dp->dec.decode_errors) : 0.f;
|
||||
dp->dec.decode_errors / (dp->dec.frames_decoded + dp->dec.decode_errors) : 0.f;
|
||||
if (err_rate > max_error_rate) {
|
||||
av_log(dp, AV_LOG_FATAL, "Decode error rate %g exceeds maximum %g\n",
|
||||
err_rate, max_error_rate);
|
||||
@@ -1021,7 +1018,6 @@ static int decoder_thread(void *arg)
|
||||
|
||||
finish:
|
||||
dec_thread_uninit(&dt);
|
||||
avcodec_free_context(&dp->dec_ctx);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1639,7 +1635,6 @@ static int dec_open(DecoderPriv *dp, AVDictionary **dec_opts,
|
||||
param_out->sample_aspect_ratio = dp->dec_ctx->sample_aspect_ratio;
|
||||
param_out->colorspace = dp->dec_ctx->colorspace;
|
||||
param_out->color_range = dp->dec_ctx->color_range;
|
||||
param_out->alpha_mode = dp->dec_ctx->alpha_mode;
|
||||
}
|
||||
|
||||
av_frame_side_data_free(¶m_out->side_data, ¶m_out->nb_side_data);
|
||||
|
||||
+3
-243
@@ -67,7 +67,6 @@ typedef struct DemuxStream {
|
||||
int reinit_filters;
|
||||
int autorotate;
|
||||
int apply_cropping;
|
||||
int force_display_matrix;
|
||||
int drop_changed;
|
||||
|
||||
|
||||
@@ -104,13 +103,6 @@ typedef struct DemuxStream {
|
||||
int64_t lag;
|
||||
} DemuxStream;
|
||||
|
||||
typedef struct DemuxStreamGroup {
|
||||
InputStreamGroup istg;
|
||||
|
||||
// name used for logging
|
||||
char log_name[32];
|
||||
} DemuxStreamGroup;
|
||||
|
||||
typedef struct Demuxer {
|
||||
InputFile f;
|
||||
|
||||
@@ -525,10 +517,7 @@ static void readrate_sleep(Demuxer *d)
|
||||
pts = av_rescale(ds->dts, 1000000, AV_TIME_BASE);
|
||||
now = av_gettime_relative();
|
||||
wc_elapsed = now - d->wallclock_start;
|
||||
|
||||
if (pts <= stream_ts_offset + initial_burst) continue;
|
||||
|
||||
max_pts = stream_ts_offset + initial_burst + (int64_t)(wc_elapsed * d->readrate);
|
||||
max_pts = stream_ts_offset + initial_burst + wc_elapsed * d->readrate;
|
||||
lag = FFMAX(max_pts - pts, 0);
|
||||
if ( (!ds->lag && lag > 0.3 * AV_TIME_BASE) || ( lag > ds->lag + 0.3 * AV_TIME_BASE) ) {
|
||||
ds->lag = lag;
|
||||
@@ -542,7 +531,7 @@ static void readrate_sleep(Demuxer *d)
|
||||
ds->lag = ds->resume_wc = ds->resume_pts = 0;
|
||||
if (ds->resume_wc) {
|
||||
elapsed = now - ds->resume_wc;
|
||||
limit_pts = ds->resume_pts + (int64_t)(elapsed * d->readrate_catchup);
|
||||
limit_pts = ds->resume_pts + elapsed * d->readrate_catchup;
|
||||
} else {
|
||||
elapsed = wc_elapsed;
|
||||
limit_pts = max_pts;
|
||||
@@ -896,16 +885,6 @@ static void ist_free(InputStream **pist)
|
||||
av_freep(pist);
|
||||
}
|
||||
|
||||
static void istg_free(InputStreamGroup **pistg)
|
||||
{
|
||||
InputStreamGroup *istg = *pistg;
|
||||
|
||||
if (!istg)
|
||||
return;
|
||||
|
||||
av_freep(pistg);
|
||||
}
|
||||
|
||||
void ifile_close(InputFile **pf)
|
||||
{
|
||||
InputFile *f = *pf;
|
||||
@@ -921,10 +900,6 @@ void ifile_close(InputFile **pf)
|
||||
ist_free(&f->streams[i]);
|
||||
av_freep(&f->streams);
|
||||
|
||||
for (int i = 0; i < f->nb_stream_groups; i++)
|
||||
istg_free(&f->stream_groups[i]);
|
||||
av_freep(&f->stream_groups);
|
||||
|
||||
avformat_close_input(&f->ctx);
|
||||
|
||||
av_packet_free(&d->pkt_heartbeat);
|
||||
@@ -1208,7 +1183,6 @@ static int add_display_matrix_to_stream(const OptionsContext *o,
|
||||
AVFormatContext *ctx, InputStream *ist)
|
||||
{
|
||||
AVStream *st = ist->st;
|
||||
DemuxStream *ds = ds_from_ist(ist);
|
||||
AVPacketSideData *sd;
|
||||
double rotation = DBL_MAX;
|
||||
int hflip = -1, vflip = -1;
|
||||
@@ -1243,8 +1217,6 @@ static int add_display_matrix_to_stream(const OptionsContext *o,
|
||||
hflip_set ? hflip : 0,
|
||||
vflip_set ? vflip : 0);
|
||||
|
||||
ds->force_display_matrix = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1483,15 +1455,6 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st, AVDictiona
|
||||
av_dict_set_int(&ds->decoder_opts, "apply_cropping",
|
||||
ds->apply_cropping && ds->apply_cropping != CROP_CONTAINER, 0);
|
||||
|
||||
if (ds->force_display_matrix) {
|
||||
char buf[32];
|
||||
if (av_dict_get(ds->decoder_opts, "side_data_prefer_packet", NULL, 0))
|
||||
buf[0] = ',';
|
||||
else
|
||||
buf[0] = '\0';
|
||||
av_strlcat(buf, "displaymatrix", sizeof(buf));
|
||||
av_dict_set(&ds->decoder_opts, "side_data_prefer_packet", buf, AV_DICT_APPEND);
|
||||
}
|
||||
/* Attached pics are sparse, therefore we would not want to delay their decoding
|
||||
* till EOF. */
|
||||
if (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)
|
||||
@@ -1610,194 +1573,6 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st, AVDictiona
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *input_stream_group_item_name(void *obj)
|
||||
{
|
||||
const DemuxStreamGroup *dsg = obj;
|
||||
|
||||
return dsg->log_name;
|
||||
}
|
||||
|
||||
static const AVClass input_stream_group_class = {
|
||||
.class_name = "InputStreamGroup",
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
.item_name = input_stream_group_item_name,
|
||||
.category = AV_CLASS_CATEGORY_DEMUXER,
|
||||
};
|
||||
|
||||
static DemuxStreamGroup *demux_stream_group_alloc(Demuxer *d, AVStreamGroup *stg)
|
||||
{
|
||||
InputFile *f = &d->f;
|
||||
DemuxStreamGroup *dsg;
|
||||
|
||||
dsg = allocate_array_elem(&f->stream_groups, sizeof(*dsg), &f->nb_stream_groups);
|
||||
if (!dsg)
|
||||
return NULL;
|
||||
|
||||
dsg->istg.stg = stg;
|
||||
dsg->istg.file = f;
|
||||
dsg->istg.index = stg->index;
|
||||
dsg->istg.class = &input_stream_group_class;
|
||||
|
||||
snprintf(dsg->log_name, sizeof(dsg->log_name), "istg#%d:%d/%s",
|
||||
d->f.index, stg->index, avformat_stream_group_name(stg->type));
|
||||
|
||||
return dsg;
|
||||
}
|
||||
|
||||
static int istg_parse_tile_grid(const OptionsContext *o, Demuxer *d, InputStreamGroup *istg)
|
||||
{
|
||||
InputFile *f = &d->f;
|
||||
AVFormatContext *ic = d->f.ctx;
|
||||
AVStreamGroup *stg = istg->stg;
|
||||
const AVStreamGroupTileGrid *tg = stg->params.tile_grid;
|
||||
OutputFilterOptions opts;
|
||||
AVBPrint bp;
|
||||
char *graph_str;
|
||||
int autorotate = 1;
|
||||
const char *apply_cropping = NULL;
|
||||
int ret;
|
||||
|
||||
if (tg->nb_tiles == 1)
|
||||
return 0;
|
||||
|
||||
memset(&opts, 0, sizeof(opts));
|
||||
|
||||
opt_match_per_stream_group_int(istg, &o->autorotate, ic, stg, &autorotate);
|
||||
if (autorotate)
|
||||
opts.flags |= OFILTER_FLAG_AUTOROTATE;
|
||||
|
||||
opts.flags |= OFILTER_FLAG_CROP;
|
||||
opt_match_per_stream_group_str(istg, &o->apply_cropping, ic, stg, &apply_cropping);
|
||||
if (apply_cropping) {
|
||||
char *p;
|
||||
int crop = strtol(apply_cropping, &p, 0);
|
||||
if (*p)
|
||||
return AVERROR(EINVAL);
|
||||
if (!crop)
|
||||
opts.flags &= ~OFILTER_FLAG_CROP;
|
||||
}
|
||||
|
||||
av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||
for (int i = 0; i < tg->nb_tiles; i++)
|
||||
av_bprintf(&bp, "[%d:g:%d:%d]", f->index, stg->index, tg->offsets[i].idx);
|
||||
av_bprintf(&bp, "xstack=inputs=%d:layout=", tg->nb_tiles);
|
||||
for (int i = 0; i < tg->nb_tiles - 1; i++)
|
||||
av_bprintf(&bp, "%d_%d|", tg->offsets[i].horizontal,
|
||||
tg->offsets[i].vertical);
|
||||
av_bprintf(&bp, "%d_%d:fill=0x%02X%02X%02X@0x%02X", tg->offsets[tg->nb_tiles - 1].horizontal,
|
||||
tg->offsets[tg->nb_tiles - 1].vertical,
|
||||
tg->background[0], tg->background[1],
|
||||
tg->background[2], tg->background[3]);
|
||||
av_bprintf(&bp, "[%d:g:%d]", f->index, stg->index);
|
||||
ret = av_bprint_finalize(&bp, &graph_str);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (tg->coded_width != tg->width || tg->coded_height != tg->height) {
|
||||
opts.crop_top = tg->vertical_offset;
|
||||
opts.crop_bottom = tg->coded_height - tg->height - tg->vertical_offset;
|
||||
opts.crop_left = tg->horizontal_offset;
|
||||
opts.crop_right = tg->coded_width - tg->width - tg->horizontal_offset;
|
||||
}
|
||||
|
||||
for (int i = 0; i < tg->nb_coded_side_data; i++) {
|
||||
const AVPacketSideData *sd = &tg->coded_side_data[i];
|
||||
|
||||
ret = av_packet_side_data_to_frame(&opts.side_data, &opts.nb_side_data, sd, 0);
|
||||
if (ret < 0 && ret != AVERROR(EINVAL))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = fg_create(NULL, &graph_str, d->sch, &opts);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
istg->fg = filtergraphs[nb_filtergraphs-1];
|
||||
istg->fg->is_internal = 1;
|
||||
|
||||
ret = 0;
|
||||
fail:
|
||||
if (ret < 0)
|
||||
av_freep(&graph_str);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int istg_add(const OptionsContext *o, Demuxer *d, AVStreamGroup *stg)
|
||||
{
|
||||
DemuxStreamGroup *dsg;
|
||||
InputStreamGroup *istg;
|
||||
int ret;
|
||||
|
||||
dsg = demux_stream_group_alloc(d, stg);
|
||||
if (!dsg)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
istg = &dsg->istg;
|
||||
|
||||
switch (stg->type) {
|
||||
case AV_STREAM_GROUP_PARAMS_TILE_GRID:
|
||||
ret = istg_parse_tile_grid(o, d, istg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_windows_reserved_device_name(const char *f)
|
||||
{
|
||||
#if HAVE_DOS_PATHS
|
||||
for (const char *p = f; p && *p; ) {
|
||||
char stem[6], *s;
|
||||
av_strlcpy(stem, p, sizeof(stem));
|
||||
if ((s = strchr(stem, '.')))
|
||||
*s = 0;
|
||||
if ((s = strpbrk(stem, "123456789")))
|
||||
*s = '1';
|
||||
|
||||
if( !av_strcasecmp(stem, "AUX") ||
|
||||
!av_strcasecmp(stem, "CON") ||
|
||||
!av_strcasecmp(stem, "NUL") ||
|
||||
!av_strcasecmp(stem, "PRN") ||
|
||||
!av_strcasecmp(stem, "COM1") ||
|
||||
!av_strcasecmp(stem, "LPT1")
|
||||
)
|
||||
return 1;
|
||||
|
||||
p = strchr(p, '/');
|
||||
if (p)
|
||||
p++;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int safe_filename(const char *f, int allow_subdir)
|
||||
{
|
||||
const char *start = f;
|
||||
|
||||
if (!*f || is_windows_reserved_device_name(f))
|
||||
return 0;
|
||||
|
||||
for (; *f; f++) {
|
||||
/* A-Za-z0-9_- */
|
||||
if (!((unsigned)((*f | 32) - 'a') < 26 ||
|
||||
(unsigned)(*f - '0') < 10 || *f == '_' || *f == '-')) {
|
||||
if (f == start)
|
||||
return 0;
|
||||
else if (allow_subdir && *f == '/')
|
||||
start = f + 1;
|
||||
else if (*f != '.')
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int dump_attachment(InputStream *ist, const char *filename)
|
||||
{
|
||||
AVStream *st = ist->st;
|
||||
@@ -1809,13 +1584,8 @@ static int dump_attachment(InputStream *ist, const char *filename)
|
||||
av_log(ist, AV_LOG_WARNING, "No extradata to dump.\n");
|
||||
return 0;
|
||||
}
|
||||
if (!*filename && (e = av_dict_get(st->metadata, "filename", NULL, 0))) {
|
||||
if (!*filename && (e = av_dict_get(st->metadata, "filename", NULL, 0)))
|
||||
filename = e->value;
|
||||
if (!safe_filename(filename, 0)) {
|
||||
av_log(ist, AV_LOG_ERROR, "Filename %s is unsafe\n", filename);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
if (!*filename) {
|
||||
av_log(ist, AV_LOG_FATAL, "No filename specified and no 'filename' tag");
|
||||
return AVERROR(EINVAL);
|
||||
@@ -1934,7 +1704,6 @@ int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
|
||||
ic = avformat_alloc_context();
|
||||
if (!ic)
|
||||
return AVERROR(ENOMEM);
|
||||
ic->name = av_strdup(d->log_name);
|
||||
if (o->audio_sample_rate.nb_opt) {
|
||||
av_dict_set_int(&o->g->format_opts, "sample_rate", o->audio_sample_rate.opt[o->audio_sample_rate.nb_opt - 1].u.i, 0);
|
||||
}
|
||||
@@ -2023,8 +1792,6 @@ int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
|
||||
|
||||
av_strlcat(d->log_name, "/", sizeof(d->log_name));
|
||||
av_strlcat(d->log_name, ic->iformat->name, sizeof(d->log_name));
|
||||
av_freep(&ic->name);
|
||||
ic->name = av_strdup(d->log_name);
|
||||
|
||||
if (scan_all_pmts_set)
|
||||
av_dict_set(&o->g->format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
|
||||
@@ -2174,13 +1941,6 @@ int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
|
||||
}
|
||||
}
|
||||
|
||||
/* Add all the stream groups from the given input file to the demuxer */
|
||||
for (int i = 0; i < ic->nb_stream_groups; i++) {
|
||||
ret = istg_add(o, d, ic->stream_groups[i]);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* dump the file content */
|
||||
av_dump_format(ic, f->index, filename, 0);
|
||||
|
||||
|
||||
+15
-25
@@ -205,10 +205,19 @@ int enc_open(void *opaque, const AVFrame *frame)
|
||||
av_assert0(frame->opaque_ref);
|
||||
fd = (FrameData*)frame->opaque_ref->data;
|
||||
|
||||
ret = clone_side_data(&enc_ctx->decoded_side_data, &enc_ctx->nb_decoded_side_data,
|
||||
fd->side_data, fd->nb_side_data, AV_FRAME_SIDE_DATA_FLAG_UNIQUE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
for (int i = 0; i < frame->nb_side_data; i++) {
|
||||
const AVSideDataDescriptor *desc = av_frame_side_data_desc(frame->side_data[i]->type);
|
||||
|
||||
if (!(desc->props & AV_SIDE_DATA_PROP_GLOBAL))
|
||||
continue;
|
||||
|
||||
ret = av_frame_side_data_clone(&enc_ctx->decoded_side_data,
|
||||
&enc_ctx->nb_decoded_side_data,
|
||||
frame->side_data[i],
|
||||
AV_FRAME_SIDE_DATA_FLAG_UNIQUE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (ist)
|
||||
@@ -257,27 +266,11 @@ int enc_open(void *opaque, const AVFrame *frame)
|
||||
enc_ctx->bits_per_raw_sample = FFMIN(fd->bits_per_raw_sample,
|
||||
av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth);
|
||||
|
||||
/**
|
||||
* The video color properties should always be in sync with the user-
|
||||
* requested values, since we forward them to the filter graph.
|
||||
*/
|
||||
enc_ctx->color_range = frame->color_range;
|
||||
enc_ctx->color_primaries = frame->color_primaries;
|
||||
enc_ctx->color_trc = frame->color_trc;
|
||||
enc_ctx->colorspace = frame->colorspace;
|
||||
enc_ctx->alpha_mode = frame->alpha_mode;
|
||||
|
||||
/* Video properties which are not part of filter graph negotiation */
|
||||
if (enc_ctx->chroma_sample_location == AVCHROMA_LOC_UNSPECIFIED) {
|
||||
enc_ctx->chroma_sample_location = frame->chroma_location;
|
||||
} else if (enc_ctx->chroma_sample_location != frame->chroma_location &&
|
||||
frame->chroma_location != AVCHROMA_LOC_UNSPECIFIED) {
|
||||
av_log(e, AV_LOG_WARNING,
|
||||
"Requested chroma sample location '%s' does not match the "
|
||||
"frame tagged sample location '%s'; result may be incorrect.\n",
|
||||
av_chroma_location_name(enc_ctx->chroma_sample_location),
|
||||
av_chroma_location_name(frame->chroma_location));
|
||||
}
|
||||
enc_ctx->chroma_sample_location = frame->chroma_location;
|
||||
|
||||
if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) ||
|
||||
(frame->flags & AV_FRAME_FLAG_INTERLACED)
|
||||
@@ -728,7 +721,7 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame,
|
||||
}
|
||||
}
|
||||
|
||||
av_unreachable("encode_frame() loop should return");
|
||||
av_assert0(0);
|
||||
}
|
||||
|
||||
static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf,
|
||||
@@ -768,9 +761,6 @@ static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf,
|
||||
}
|
||||
} else if (kf->type == KF_FORCE_SOURCE && (frame->flags & AV_FRAME_FLAG_KEY)) {
|
||||
goto force_keyframe;
|
||||
} else if (kf->type == KF_FORCE_SCD_METADATA &&
|
||||
av_dict_get(frame->metadata, "lavfi.scd.time", NULL, 0)) {
|
||||
goto force_keyframe;
|
||||
}
|
||||
|
||||
return AV_PICTURE_TYPE_NONE;
|
||||
|
||||
+64
-307
@@ -40,6 +40,9 @@
|
||||
#include "libavutil/time.h"
|
||||
#include "libavutil/timestamp.h"
|
||||
|
||||
// FIXME private header, used for mid_pred()
|
||||
#include "libavcodec/mathops.h"
|
||||
|
||||
typedef struct FilterGraphPriv {
|
||||
FilterGraph fg;
|
||||
|
||||
@@ -106,9 +109,6 @@ typedef struct InputFilterPriv {
|
||||
// used to hold submitted input
|
||||
AVFrame *frame;
|
||||
|
||||
// For inputs bound to a filtergraph output
|
||||
OutputFilter *ofilter_src;
|
||||
|
||||
// source data type: AVMEDIA_TYPE_SUBTITLE for sub2video,
|
||||
// same as type otherwise
|
||||
enum AVMediaType type_src;
|
||||
@@ -125,7 +125,6 @@ typedef struct InputFilterPriv {
|
||||
AVRational sample_aspect_ratio;
|
||||
enum AVColorSpace color_space;
|
||||
enum AVColorRange color_range;
|
||||
enum AVAlphaMode alpha_mode;
|
||||
|
||||
int sample_rate;
|
||||
AVChannelLayout ch_layout;
|
||||
@@ -190,8 +189,6 @@ typedef struct OutputFilterPriv {
|
||||
void *log_parent;
|
||||
char log_name[32];
|
||||
|
||||
int needed;
|
||||
|
||||
/* desired output stream properties */
|
||||
int format;
|
||||
int width, height;
|
||||
@@ -199,12 +196,6 @@ typedef struct OutputFilterPriv {
|
||||
AVChannelLayout ch_layout;
|
||||
enum AVColorSpace color_space;
|
||||
enum AVColorRange color_range;
|
||||
enum AVAlphaMode alpha_mode;
|
||||
|
||||
unsigned crop_top;
|
||||
unsigned crop_bottom;
|
||||
unsigned crop_left;
|
||||
unsigned crop_right;
|
||||
|
||||
AVFrameSideData **side_data;
|
||||
int nb_side_data;
|
||||
@@ -223,17 +214,11 @@ typedef struct OutputFilterPriv {
|
||||
|
||||
// those are only set if no format is specified and the encoder gives us multiple options
|
||||
// They point directly to the relevant lists of the encoder.
|
||||
union {
|
||||
const enum AVPixelFormat *pix_fmts;
|
||||
const enum AVSampleFormat *sample_fmts;
|
||||
};
|
||||
const int *formats;
|
||||
const AVChannelLayout *ch_layouts;
|
||||
const int *sample_rates;
|
||||
const enum AVColorSpace *color_spaces;
|
||||
const enum AVColorRange *color_ranges;
|
||||
const enum AVAlphaMode *alpha_modes;
|
||||
|
||||
int32_t displaymatrix[9];
|
||||
|
||||
AVRational enc_timebase;
|
||||
int64_t trim_start_us;
|
||||
@@ -283,7 +268,6 @@ static int sub2video_get_blank_frame(InputFilterPriv *ifp)
|
||||
frame->format = ifp->format;
|
||||
frame->colorspace = ifp->color_space;
|
||||
frame->color_range = ifp->color_range;
|
||||
frame->alpha_mode = ifp->alpha_mode;
|
||||
|
||||
ret = av_frame_get_buffer(frame, 0);
|
||||
if (ret < 0)
|
||||
@@ -402,10 +386,10 @@ static void choose_ ## name (OutputFilterPriv *ofp, AVBPrint *bprint) \
|
||||
av_bprint_chars(bprint, ':', 1); \
|
||||
}
|
||||
|
||||
DEF_CHOOSE_FORMAT(pix_fmts, enum AVPixelFormat, format, pix_fmts,
|
||||
DEF_CHOOSE_FORMAT(pix_fmts, enum AVPixelFormat, format, formats,
|
||||
AV_PIX_FMT_NONE, "%s", av_get_pix_fmt_name)
|
||||
|
||||
DEF_CHOOSE_FORMAT(sample_fmts, enum AVSampleFormat, format, sample_fmts,
|
||||
DEF_CHOOSE_FORMAT(sample_fmts, enum AVSampleFormat, format, formats,
|
||||
AV_SAMPLE_FMT_NONE, "%s", av_get_sample_fmt_name)
|
||||
|
||||
DEF_CHOOSE_FORMAT(sample_rates, int, sample_rate, sample_rates, 0,
|
||||
@@ -417,9 +401,6 @@ DEF_CHOOSE_FORMAT(color_spaces, enum AVColorSpace, color_space, color_spaces,
|
||||
DEF_CHOOSE_FORMAT(color_ranges, enum AVColorRange, color_range, color_ranges,
|
||||
AVCOL_RANGE_UNSPECIFIED, "%s", av_color_range_name);
|
||||
|
||||
DEF_CHOOSE_FORMAT(alpha_modes, enum AVAlphaMode, alpha_mode, alpha_modes,
|
||||
AVALPHA_MODE_UNSPECIFIED, "%s", av_alpha_mode_name);
|
||||
|
||||
static void choose_channel_layouts(OutputFilterPriv *ofp, AVBPrint *bprint)
|
||||
{
|
||||
if (av_channel_layout_check(&ofp->ch_layout)) {
|
||||
@@ -519,7 +500,7 @@ static int filter_opt_apply(void *logctx, AVFilterContext *f,
|
||||
ret = av_opt_set_bin(f, key, data, len, AV_OPT_SEARCH_CHILDREN);
|
||||
av_freep(&data);
|
||||
} else {
|
||||
char *data = read_file_to_string(val);
|
||||
char *data = file_read(val);
|
||||
if (!data) {
|
||||
ret = AVERROR(EIO);
|
||||
goto err_load;
|
||||
@@ -669,7 +650,6 @@ static OutputFilter *ofilter_alloc(FilterGraph *fg, enum AVMediaType type)
|
||||
ofp->format = -1;
|
||||
ofp->color_space = AVCOL_SPC_UNSPECIFIED;
|
||||
ofp->color_range = AVCOL_RANGE_UNSPECIFIED;
|
||||
ofp->alpha_mode = AVALPHA_MODE_UNSPECIFIED;
|
||||
ofilter->index = fg->nb_outputs - 1;
|
||||
|
||||
snprintf(ofp->log_name, sizeof(ofp->log_name), "%co%d",
|
||||
@@ -822,10 +802,10 @@ int ofilter_bind_enc(OutputFilter *ofilter, unsigned sched_idx_enc,
|
||||
av_assert0(!opts->enc ||
|
||||
ofilter->type == opts->enc->type);
|
||||
|
||||
ofp->needed = ofilter->bound = 1;
|
||||
ofilter->bound = 1;
|
||||
av_freep(&ofilter->linklabel);
|
||||
|
||||
ofp->flags |= opts->flags;
|
||||
ofp->flags = opts->flags;
|
||||
ofp->ts_offset = opts->ts_offset;
|
||||
ofp->enc_timebase = opts->output_tb;
|
||||
|
||||
@@ -862,7 +842,7 @@ int ofilter_bind_enc(OutputFilter *ofilter, unsigned sched_idx_enc,
|
||||
if (opts->format != AV_PIX_FMT_NONE) {
|
||||
ofp->format = opts->format;
|
||||
} else
|
||||
ofp->pix_fmts = opts->pix_fmts;
|
||||
ofp->formats = opts->formats;
|
||||
|
||||
if (opts->color_space != AVCOL_SPC_UNSPECIFIED)
|
||||
ofp->color_space = opts->color_space;
|
||||
@@ -874,11 +854,6 @@ int ofilter_bind_enc(OutputFilter *ofilter, unsigned sched_idx_enc,
|
||||
else
|
||||
ofp->color_ranges = opts->color_ranges;
|
||||
|
||||
if (opts->alpha_mode != AVALPHA_MODE_UNSPECIFIED)
|
||||
ofp->alpha_mode = opts->alpha_mode;
|
||||
else
|
||||
ofp->alpha_modes = opts->alpha_modes;
|
||||
|
||||
fgp->disable_conversions |= !!(ofp->flags & OFILTER_FLAG_DISABLE_CONVERT);
|
||||
|
||||
ofp->fps.last_frame = av_frame_alloc();
|
||||
@@ -901,7 +876,7 @@ int ofilter_bind_enc(OutputFilter *ofilter, unsigned sched_idx_enc,
|
||||
if (opts->format != AV_SAMPLE_FMT_NONE) {
|
||||
ofp->format = opts->format;
|
||||
} else {
|
||||
ofp->sample_fmts = opts->sample_fmts;
|
||||
ofp->formats = opts->formats;
|
||||
}
|
||||
if (opts->sample_rate) {
|
||||
ofp->sample_rate = opts->sample_rate;
|
||||
@@ -933,15 +908,13 @@ static int ofilter_bind_ifilter(OutputFilter *ofilter, InputFilterPriv *ifp,
|
||||
av_assert0(!ofilter->bound);
|
||||
av_assert0(ofilter->type == ifp->ifilter.type);
|
||||
|
||||
ofp->needed = ofilter->bound = 1;
|
||||
ofilter->bound = 1;
|
||||
av_freep(&ofilter->linklabel);
|
||||
|
||||
ofilter->output_name = av_strdup(opts->name);
|
||||
if (!ofilter->output_name)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
ifp->ofilter_src = ofilter;
|
||||
|
||||
av_strlcatf(ofp->log_name, sizeof(ofp->log_name), "->%s", ofilter->output_name);
|
||||
|
||||
return 0;
|
||||
@@ -1004,7 +977,6 @@ static InputFilter *ifilter_alloc(FilterGraph *fg)
|
||||
ifp->format = -1;
|
||||
ifp->color_space = AVCOL_SPC_UNSPECIFIED;
|
||||
ifp->color_range = AVCOL_RANGE_UNSPECIFIED;
|
||||
ifp->alpha_mode = AVALPHA_MODE_UNSPECIFIED;
|
||||
|
||||
ifp->frame_queue = av_fifo_alloc2(8, sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW);
|
||||
if (!ifp->frame_queue)
|
||||
@@ -1085,8 +1057,7 @@ static const AVClass fg_class = {
|
||||
.category = AV_CLASS_CATEGORY_FILTER,
|
||||
};
|
||||
|
||||
int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch,
|
||||
const OutputFilterOptions *opts)
|
||||
int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch)
|
||||
{
|
||||
FilterGraphPriv *fgp;
|
||||
FilterGraph *fg;
|
||||
@@ -1097,7 +1068,7 @@ int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch,
|
||||
|
||||
fgp = av_mallocz(sizeof(*fgp));
|
||||
if (!fgp) {
|
||||
av_freep(graph_desc);
|
||||
av_freep(&graph_desc);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
fg = &fgp->fg;
|
||||
@@ -1108,7 +1079,7 @@ int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch,
|
||||
} else {
|
||||
ret = av_dynarray_add_nofree(&filtergraphs, &nb_filtergraphs, fgp);
|
||||
if (ret < 0) {
|
||||
av_freep(graph_desc);
|
||||
av_freep(&graph_desc);
|
||||
av_freep(&fgp);
|
||||
return ret;
|
||||
}
|
||||
@@ -1117,13 +1088,11 @@ int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch,
|
||||
}
|
||||
|
||||
fg->class = &fg_class;
|
||||
fg->graph_desc = *graph_desc;
|
||||
fg->graph_desc = graph_desc;
|
||||
fgp->disable_conversions = !auto_conversion_filters;
|
||||
fgp->nb_threads = -1;
|
||||
fgp->sch = sch;
|
||||
|
||||
*graph_desc = NULL;
|
||||
|
||||
snprintf(fgp->log_name, sizeof(fgp->log_name), "fc#%d", fg->index);
|
||||
|
||||
fgp->frame = av_frame_alloc();
|
||||
@@ -1185,13 +1154,11 @@ int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch,
|
||||
const enum AVMediaType type = avfilter_pad_get_type(cur->filter_ctx->output_pads,
|
||||
cur->pad_idx);
|
||||
OutputFilter *const ofilter = ofilter_alloc(fg, type);
|
||||
OutputFilterPriv *ofp;
|
||||
|
||||
if (!ofilter) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
ofp = ofp_from_ofilter(ofilter);
|
||||
|
||||
ofilter->linklabel = cur->name;
|
||||
cur->name = NULL;
|
||||
@@ -1201,25 +1168,6 @@ int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch,
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// opts should only be needed in this function to fill fields from filtergraphs
|
||||
// whose output is meant to be treated as if it was stream, e.g. merged HEIF
|
||||
// tile groups.
|
||||
if (opts) {
|
||||
ofp->flags = opts->flags;
|
||||
ofp->side_data = opts->side_data;
|
||||
ofp->nb_side_data = opts->nb_side_data;
|
||||
|
||||
ofp->crop_top = opts->crop_top;
|
||||
ofp->crop_bottom = opts->crop_bottom;
|
||||
ofp->crop_left = opts->crop_left;
|
||||
ofp->crop_right = opts->crop_right;
|
||||
|
||||
const AVFrameSideData *sd = av_frame_side_data_get(ofp->side_data, ofp->nb_side_data,
|
||||
AV_FRAME_DATA_DISPLAYMATRIX);
|
||||
if (sd)
|
||||
memcpy(ofp->displaymatrix, sd->data, sizeof(ofp->displaymatrix));
|
||||
}
|
||||
}
|
||||
|
||||
if (!fg->nb_outputs) {
|
||||
@@ -1247,7 +1195,7 @@ fail:
|
||||
|
||||
int fg_create_simple(FilterGraph **pfg,
|
||||
InputStream *ist,
|
||||
char **graph_desc,
|
||||
char *graph_desc,
|
||||
Scheduler *sch, unsigned sched_idx_enc,
|
||||
const OutputFilterOptions *opts)
|
||||
{
|
||||
@@ -1256,7 +1204,7 @@ int fg_create_simple(FilterGraph **pfg,
|
||||
FilterGraphPriv *fgp;
|
||||
int ret;
|
||||
|
||||
ret = fg_create(pfg, graph_desc, sch, NULL);
|
||||
ret = fg_create(pfg, graph_desc, sch);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
fg = *pfg;
|
||||
@@ -1272,7 +1220,7 @@ int fg_create_simple(FilterGraph **pfg,
|
||||
"to have exactly 1 input and 1 output. "
|
||||
"However, it had %d input(s) and %d output(s). Please adjust, "
|
||||
"or use a complex filtergraph (-filter_complex) instead.\n",
|
||||
*graph_desc, fg->nb_inputs, fg->nb_outputs);
|
||||
graph_desc, fg->nb_inputs, fg->nb_outputs);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (fg->outputs[0]->type != type) {
|
||||
@@ -1297,7 +1245,7 @@ int fg_create_simple(FilterGraph **pfg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fg_complex_bind_input(FilterGraph *fg, InputFilter *ifilter, int commit)
|
||||
static int fg_complex_bind_input(FilterGraph *fg, InputFilter *ifilter)
|
||||
{
|
||||
InputFilterPriv *ifp = ifp_from_ifilter(ifilter);
|
||||
InputStream *ist = NULL;
|
||||
@@ -1348,20 +1296,15 @@ static int fg_complex_bind_input(FilterGraph *fg, InputFilter *ifilter, int comm
|
||||
|
||||
if (!ofilter->bound && ofilter->linklabel &&
|
||||
!strcmp(ofilter->linklabel, ifilter->linklabel)) {
|
||||
if (commit) {
|
||||
av_log(fg, AV_LOG_VERBOSE,
|
||||
"Binding input with label '%s' to filtergraph output %d:%d\n",
|
||||
ifilter->linklabel, i, j);
|
||||
av_log(fg, AV_LOG_VERBOSE,
|
||||
"Binding input with label '%s' to filtergraph output %d:%d\n",
|
||||
ifilter->linklabel, i, j);
|
||||
|
||||
ret = ifilter_bind_fg(ifp, fg_src, j);
|
||||
if (ret < 0) {
|
||||
av_log(fg, AV_LOG_ERROR, "Error binding filtergraph input %s\n",
|
||||
ifilter->linklabel);
|
||||
return ret;
|
||||
}
|
||||
} else
|
||||
ofp_from_ofilter(ofilter)->needed = 1;
|
||||
return 0;
|
||||
ret = ifilter_bind_fg(ifp, fg_src, j);
|
||||
if (ret < 0)
|
||||
av_log(fg, AV_LOG_ERROR, "Error binding filtergraph input %s\n",
|
||||
ifilter->linklabel);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1409,38 +1352,10 @@ static int fg_complex_bind_input(FilterGraph *fg, InputFilter *ifilter, int comm
|
||||
}
|
||||
ist = input_files[file_idx]->streams[st->index];
|
||||
|
||||
if (commit)
|
||||
av_log(fg, AV_LOG_VERBOSE,
|
||||
"Binding input with label '%s' to input stream %d:%d\n",
|
||||
ifilter->linklabel, ist->file->index, ist->index);
|
||||
av_log(fg, AV_LOG_VERBOSE,
|
||||
"Binding input with label '%s' to input stream %d:%d\n",
|
||||
ifilter->linklabel, ist->file->index, ist->index);
|
||||
} else {
|
||||
// try finding an unbound filtergraph output
|
||||
for (int i = 0; i < nb_filtergraphs; i++) {
|
||||
FilterGraph *fg_src = filtergraphs[i];
|
||||
|
||||
if (fg == fg_src)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < fg_src->nb_outputs; j++) {
|
||||
OutputFilter *ofilter = fg_src->outputs[j];
|
||||
|
||||
if (!ofilter->bound) {
|
||||
if (commit) {
|
||||
av_log(fg, AV_LOG_VERBOSE,
|
||||
"Binding unlabeled filtergraph input to filtergraph output %d:%d\n", i, j);
|
||||
|
||||
ret = ifilter_bind_fg(ifp, fg_src, j);
|
||||
if (ret < 0) {
|
||||
av_log(fg, AV_LOG_ERROR, "Error binding filtergraph input %d:%d\n", i, j);
|
||||
return ret;
|
||||
}
|
||||
} else
|
||||
ofp_from_ofilter(ofilter)->needed = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ist = ist_find_unused(type);
|
||||
if (!ist) {
|
||||
av_log(fg, AV_LOG_FATAL,
|
||||
@@ -1450,27 +1365,24 @@ static int fg_complex_bind_input(FilterGraph *fg, InputFilter *ifilter, int comm
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (commit)
|
||||
av_log(fg, AV_LOG_VERBOSE,
|
||||
"Binding unlabeled input %d to input stream %d:%d\n",
|
||||
ifilter->index, ist->file->index, ist->index);
|
||||
av_log(fg, AV_LOG_VERBOSE,
|
||||
"Binding unlabeled input %d to input stream %d:%d\n",
|
||||
ifilter->index, ist->file->index, ist->index);
|
||||
}
|
||||
av_assert0(ist);
|
||||
|
||||
if (commit) {
|
||||
ret = ifilter_bind_ist(ifilter, ist, &vs);
|
||||
if (ret < 0) {
|
||||
av_log(fg, AV_LOG_ERROR,
|
||||
"Error binding an input stream to complex filtergraph input %s.\n",
|
||||
ifilter->name);
|
||||
return ret;
|
||||
}
|
||||
ret = ifilter_bind_ist(ifilter, ist, &vs);
|
||||
if (ret < 0) {
|
||||
av_log(fg, AV_LOG_ERROR,
|
||||
"Error binding an input stream to complex filtergraph input %s.\n",
|
||||
ifilter->name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bind_inputs(FilterGraph *fg, int commit)
|
||||
static int bind_inputs(FilterGraph *fg)
|
||||
{
|
||||
// bind filtergraph inputs to input streams or other filtergraphs
|
||||
for (int i = 0; i < fg->nb_inputs; i++) {
|
||||
@@ -1480,7 +1392,7 @@ static int bind_inputs(FilterGraph *fg, int commit)
|
||||
if (ifp->bound)
|
||||
continue;
|
||||
|
||||
ret = fg_complex_bind_input(fg, &ifp->ifilter, commit);
|
||||
ret = fg_complex_bind_input(fg, &ifp->ifilter);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
@@ -1493,49 +1405,27 @@ int fg_finalise_bindings(void)
|
||||
int ret;
|
||||
|
||||
for (int i = 0; i < nb_filtergraphs; i++) {
|
||||
ret = bind_inputs(filtergraphs[i], 0);
|
||||
ret = bind_inputs(filtergraphs[i]);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
// check that all outputs were bound
|
||||
for (int i = nb_filtergraphs - 1; i >= 0; i--) {
|
||||
for (int i = 0; i < nb_filtergraphs; i++) {
|
||||
FilterGraph *fg = filtergraphs[i];
|
||||
FilterGraphPriv *fgp = fgp_from_fg(filtergraphs[i]);
|
||||
|
||||
for (int j = 0; j < fg->nb_outputs; j++) {
|
||||
OutputFilter *output = fg->outputs[j];
|
||||
if (!ofp_from_ofilter(output)->needed) {
|
||||
if (!fg->is_internal) {
|
||||
av_log(fg, AV_LOG_FATAL,
|
||||
"Filter '%s' has output %d (%s) unconnected\n",
|
||||
output->name, j,
|
||||
output->linklabel ? (const char *)output->linklabel : "unlabeled");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
av_log(fg, AV_LOG_DEBUG,
|
||||
"Internal filter '%s' has output %d (%s) unconnected. Removing graph\n",
|
||||
if (!output->bound) {
|
||||
av_log(fg, AV_LOG_FATAL,
|
||||
"Filter '%s' has output %d (%s) unconnected\n",
|
||||
output->name, j,
|
||||
output->linklabel ? (const char *)output->linklabel : "unlabeled");
|
||||
sch_remove_filtergraph(fgp->sch, fgp->sch_idx);
|
||||
fg_free(&filtergraphs[i]);
|
||||
nb_filtergraphs--;
|
||||
if (nb_filtergraphs > 0)
|
||||
memmove(&filtergraphs[i],
|
||||
&filtergraphs[i + 1],
|
||||
(nb_filtergraphs - i) * sizeof(*filtergraphs));
|
||||
break;
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < nb_filtergraphs; i++) {
|
||||
ret = bind_inputs(filtergraphs[i], 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1634,53 +1524,6 @@ static int configure_output_video_filter(FilterGraphPriv *fgp, AVFilterGraph *gr
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (ofp->flags & OFILTER_FLAG_CROP) {
|
||||
char crop_buf[64];
|
||||
snprintf(crop_buf, sizeof(crop_buf), "w=iw-%u-%u:h=ih-%u-%u:x=%u:y=%u",
|
||||
ofp->crop_left, ofp->crop_right,
|
||||
ofp->crop_top, ofp->crop_bottom,
|
||||
ofp->crop_left, ofp->crop_top);
|
||||
ret = insert_filter(&last_filter, &pad_idx, "crop", crop_buf);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (ofp->flags & OFILTER_FLAG_AUTOROTATE) {
|
||||
int32_t *displaymatrix = ofp->displaymatrix;
|
||||
double theta;
|
||||
|
||||
theta = get_rotation(displaymatrix);
|
||||
|
||||
if (fabs(theta - 90) < 1.0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "transpose",
|
||||
displaymatrix[3] > 0 ? "cclock_flip" : "clock");
|
||||
} else if (fabs(theta - 180) < 1.0) {
|
||||
if (displaymatrix[0] < 0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
if (displaymatrix[4] < 0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
|
||||
}
|
||||
} else if (fabs(theta - 270) < 1.0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "transpose",
|
||||
displaymatrix[3] < 0 ? "clock_flip" : "cclock");
|
||||
} else if (fabs(theta) > 1.0) {
|
||||
char rotate_buf[64];
|
||||
snprintf(rotate_buf, sizeof(rotate_buf), "%f*PI/180", theta);
|
||||
ret = insert_filter(&last_filter, &pad_idx, "rotate", rotate_buf);
|
||||
} else if (fabs(theta) < 1.0) {
|
||||
if (displaymatrix && displaymatrix[4] < 0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
|
||||
}
|
||||
}
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
av_frame_side_data_remove(&ofp->side_data, &ofp->nb_side_data, AV_FRAME_DATA_DISPLAYMATRIX);
|
||||
}
|
||||
|
||||
if ((ofp->width || ofp->height) && (ofp->flags & OFILTER_FLAG_AUTOSCALE)) {
|
||||
char args[255];
|
||||
AVFilterContext *filter;
|
||||
@@ -1705,12 +1548,11 @@ static int configure_output_video_filter(FilterGraphPriv *fgp, AVFilterGraph *gr
|
||||
}
|
||||
|
||||
av_assert0(!(ofp->flags & OFILTER_FLAG_DISABLE_CONVERT) ||
|
||||
ofp->format != AV_PIX_FMT_NONE || !ofp->pix_fmts);
|
||||
ofp->format != AV_PIX_FMT_NONE || !ofp->formats);
|
||||
av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||
choose_pix_fmts(ofp, &bprint);
|
||||
choose_color_spaces(ofp, &bprint);
|
||||
choose_color_ranges(ofp, &bprint);
|
||||
choose_alpha_modes(ofp, &bprint);
|
||||
if (!av_bprint_is_complete(&bprint))
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -1881,7 +1723,6 @@ static int configure_input_video_filter(FilterGraph *fg, AVFilterGraph *graph,
|
||||
ifp->sample_aspect_ratio : (AVRational){ 0, 1 };
|
||||
par->color_space = ifp->color_space;
|
||||
par->color_range = ifp->color_range;
|
||||
par->alpha_mode = ifp->alpha_mode;
|
||||
par->hw_frames_ctx = ifp->hw_frames_ctx;
|
||||
par->side_data = ifp->side_data;
|
||||
par->nb_side_data = ifp->nb_side_data;
|
||||
@@ -2159,7 +2000,6 @@ static int configure_filtergraph(FilterGraph *fg, FilterGraphThread *fgt)
|
||||
ofp->height = av_buffersink_get_h(sink);
|
||||
ofp->color_space = av_buffersink_get_colorspace(sink);
|
||||
ofp->color_range = av_buffersink_get_color_range(sink);
|
||||
ofp->alpha_mode = av_buffersink_get_alpha_mode(sink);
|
||||
|
||||
// If the timing parameters are not locked yet, get the tentative values
|
||||
// here but don't lock them. They will only be used if no output frames
|
||||
@@ -2178,11 +2018,12 @@ static int configure_filtergraph(FilterGraph *fg, FilterGraphThread *fgt)
|
||||
ret = av_buffersink_get_ch_layout(sink, &ofp->ch_layout);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
av_frame_side_data_free(&ofp->side_data, &ofp->nb_side_data);
|
||||
sd = av_buffersink_get_side_data(sink, &nb_sd);
|
||||
if (nb_sd)
|
||||
for (int j = 0; j < nb_sd; j++) {
|
||||
ret = av_frame_side_data_clone(&ofp->side_data, &ofp->nb_side_data,
|
||||
sd[j], AV_FRAME_SIDE_DATA_FLAG_REPLACE);
|
||||
sd[j], 0);
|
||||
if (ret < 0) {
|
||||
av_frame_side_data_free(&ofp->side_data, &ofp->nb_side_data);
|
||||
goto fail;
|
||||
@@ -2255,7 +2096,6 @@ static int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *fr
|
||||
ifp->sample_aspect_ratio = frame->sample_aspect_ratio;
|
||||
ifp->color_space = frame->colorspace;
|
||||
ifp->color_range = frame->color_range;
|
||||
ifp->alpha_mode = frame->alpha_mode;
|
||||
|
||||
ifp->sample_rate = frame->sample_rate;
|
||||
ret = av_channel_layout_copy(&ifp->ch_layout, &frame->ch_layout);
|
||||
@@ -2266,8 +2106,7 @@ static int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *fr
|
||||
for (int i = 0; i < frame->nb_side_data; i++) {
|
||||
const AVSideDataDescriptor *desc = av_frame_side_data_desc(frame->side_data[i]->type);
|
||||
|
||||
if (!(desc->props & AV_SIDE_DATA_PROP_GLOBAL) ||
|
||||
frame->side_data[i]->type == AV_FRAME_DATA_DISPLAYMATRIX)
|
||||
if (!(desc->props & AV_SIDE_DATA_PROP_GLOBAL))
|
||||
continue;
|
||||
|
||||
ret = av_frame_side_data_clone(&ifp->side_data,
|
||||
@@ -2298,27 +2137,6 @@ static int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *fr
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ifilter_parameters_from_ofilter(InputFilter *ifilter, OutputFilter *ofilter)
|
||||
{
|
||||
const OutputFilterPriv *ofp = ofp_from_ofilter(ofilter);
|
||||
InputFilterPriv *ifp = ifp_from_ifilter(ifilter);
|
||||
|
||||
if (!ifp->opts.framerate.num) {
|
||||
ifp->opts.framerate = ofp->fps.framerate;
|
||||
if (ifp->opts.framerate.num > 0 && ifp->opts.framerate.den > 0)
|
||||
ifp->opts.flags |= IFILTER_FLAG_CFR;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ofp->nb_side_data; i++) {
|
||||
int ret = av_frame_side_data_clone(&ifp->side_data, &ifp->nb_side_data,
|
||||
ofp->side_data[i], AV_FRAME_SIDE_DATA_FLAG_REPLACE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int filtergraph_is_simple(const FilterGraph *fg)
|
||||
{
|
||||
const FilterGraphPriv *fgp = cfgp_from_cfg(fg);
|
||||
@@ -2489,23 +2307,6 @@ early_exit:
|
||||
return float_pts;
|
||||
}
|
||||
|
||||
static int64_t median3(int64_t a, int64_t b, int64_t c)
|
||||
{
|
||||
int64_t max2, min2, m;
|
||||
|
||||
if (a >= b) {
|
||||
max2 = a;
|
||||
min2 = b;
|
||||
} else {
|
||||
max2 = b;
|
||||
min2 = a;
|
||||
}
|
||||
m = (c >= max2) ? max2 : c;
|
||||
|
||||
return (m >= min2) ? m : min2;
|
||||
}
|
||||
|
||||
|
||||
/* Convert frame timestamps to the encoder timebase and decide how many times
|
||||
* should this (and possibly previous) frame be repeated in order to conform to
|
||||
* desired target framerate (if any).
|
||||
@@ -2518,9 +2319,9 @@ static void video_sync_process(OutputFilterPriv *ofp, AVFrame *frame,
|
||||
double delta0, delta, sync_ipts, duration;
|
||||
|
||||
if (!frame) {
|
||||
*nb_frames_prev = *nb_frames = median3(fps->frames_prev_hist[0],
|
||||
fps->frames_prev_hist[1],
|
||||
fps->frames_prev_hist[2]);
|
||||
*nb_frames_prev = *nb_frames = mid_pred(fps->frames_prev_hist[0],
|
||||
fps->frames_prev_hist[1],
|
||||
fps->frames_prev_hist[2]);
|
||||
|
||||
if (!*nb_frames && fps->last_dropped) {
|
||||
atomic_fetch_add(&ofilter->nb_frames_drop, 1);
|
||||
@@ -2633,16 +2434,6 @@ finish:
|
||||
fps->dropped_keyframe |= fps->last_dropped && (frame->flags & AV_FRAME_FLAG_KEY);
|
||||
}
|
||||
|
||||
static void close_input(InputFilterPriv *ifp)
|
||||
{
|
||||
FilterGraphPriv *fgp = fgp_from_fg(ifp->ifilter.graph);
|
||||
|
||||
if (!ifp->eof) {
|
||||
sch_filter_receive_finish(fgp->sch, fgp->sch_idx, ifp->ifilter.index);
|
||||
ifp->eof = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int close_output(OutputFilterPriv *ofp, FilterGraphThread *fgt)
|
||||
{
|
||||
FilterGraphPriv *fgp = fgp_from_fg(ofp->ofilter.graph);
|
||||
@@ -2667,17 +2458,16 @@ static int close_output(OutputFilterPriv *ofp, FilterGraphThread *fgt)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
av_frame_side_data_free(&frame->side_data, &frame->nb_side_data);
|
||||
ret = clone_side_data(&frame->side_data, &frame->nb_side_data,
|
||||
ofp->side_data, ofp->nb_side_data, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
fd = frame_data(frame);
|
||||
if (!fd)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
av_frame_side_data_free(&fd->side_data, &fd->nb_side_data);
|
||||
ret = clone_side_data(&fd->side_data, &fd->nb_side_data,
|
||||
ofp->side_data, ofp->nb_side_data, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
fd->frame_rate_filter = ofp->fps.framerate;
|
||||
|
||||
av_assert0(!frame->buf[0]);
|
||||
@@ -2832,14 +2622,6 @@ static int fg_output_step(OutputFilterPriv *ofp, FilterGraphThread *fgt,
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
av_frame_side_data_free(&fd->side_data, &fd->nb_side_data);
|
||||
if (!fgt->got_frame) {
|
||||
ret = clone_side_data(&fd->side_data, &fd->nb_side_data,
|
||||
ofp->side_data, ofp->nb_side_data, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
fd->wallclock[LATENCY_PROBE_FILTER_POST] = av_gettime_relative();
|
||||
|
||||
// only use bits_per_raw_sample passed through from the decoder
|
||||
@@ -3027,7 +2809,6 @@ static int send_eof(FilterGraphThread *fgt, InputFilter *ifilter,
|
||||
ifp->sample_aspect_ratio = ifp->opts.fallback->sample_aspect_ratio;
|
||||
ifp->color_space = ifp->opts.fallback->colorspace;
|
||||
ifp->color_range = ifp->opts.fallback->color_range;
|
||||
ifp->alpha_mode = ifp->opts.fallback->alpha_mode;
|
||||
ifp->time_base = ifp->opts.fallback->time_base;
|
||||
|
||||
ret = av_channel_layout_copy(&ifp->ch_layout,
|
||||
@@ -3078,7 +2859,6 @@ static const char *unknown_if_null(const char *str)
|
||||
static int send_frame(FilterGraph *fg, FilterGraphThread *fgt,
|
||||
InputFilter *ifilter, AVFrame *frame)
|
||||
{
|
||||
FilterGraphPriv *fgp = fgp_from_fg(fg);
|
||||
InputFilterPriv *ifp = ifp_from_ifilter(ifilter);
|
||||
FrameData *fd;
|
||||
AVFrameSideData *sd;
|
||||
@@ -3097,8 +2877,7 @@ static int send_frame(FilterGraph *fg, FilterGraphThread *fgt,
|
||||
ifp->width != frame->width ||
|
||||
ifp->height != frame->height ||
|
||||
ifp->color_space != frame->colorspace ||
|
||||
ifp->color_range != frame->color_range ||
|
||||
ifp->alpha_mode != frame->alpha_mode)
|
||||
ifp->color_range != frame->color_range)
|
||||
need_reinit |= VIDEO_CHANGED;
|
||||
break;
|
||||
}
|
||||
@@ -3135,14 +2914,6 @@ static int send_frame(FilterGraph *fg, FilterGraphThread *fgt,
|
||||
ret = ifilter_parameters_from_frame(ifilter, frame);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Inputs bound to a filtergraph output will have some fields unset.
|
||||
* Handle them here */
|
||||
if (ifp->ofilter_src) {
|
||||
ret = ifilter_parameters_from_ofilter(ifilter, ifp->ofilter_src);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* (re)init the graph if possible, otherwise buffer the frame and return */
|
||||
@@ -3180,11 +2951,9 @@ static int send_frame(FilterGraph *fg, FilterGraphThread *fgt,
|
||||
const char *pixel_format_name = av_get_pix_fmt_name(frame->format);
|
||||
const char *color_space_name = av_color_space_name(frame->colorspace);
|
||||
const char *color_range_name = av_color_range_name(frame->color_range);
|
||||
const char *alpha_mode = av_alpha_mode_name(frame->alpha_mode);
|
||||
av_bprintf(&reason, "video parameters changed to %s(%s, %s), %dx%d, %s alpha,",
|
||||
av_bprintf(&reason, "video parameters changed to %s(%s, %s), %dx%d, ",
|
||||
unknown_if_null(pixel_format_name), unknown_if_null(color_range_name),
|
||||
unknown_if_null(color_space_name), frame->width, frame->height,
|
||||
unknown_if_null(alpha_mode));
|
||||
unknown_if_null(color_space_name), frame->width, frame->height);
|
||||
}
|
||||
if (need_reinit & MATRIX_CHANGED)
|
||||
av_bprintf(&reason, "display matrix changed, ");
|
||||
@@ -3195,11 +2964,6 @@ static int send_frame(FilterGraph *fg, FilterGraphThread *fgt,
|
||||
if (reason.len > 1)
|
||||
reason.str[reason.len - 2] = '\0'; // remove last comma
|
||||
av_log(fg, AV_LOG_INFO, "Reconfiguring filter graph%s%s\n", reason.len ? " because " : "", reason.str);
|
||||
} else {
|
||||
/* Choke all input to avoid buffering excessive frames while the
|
||||
* initial filter graph is being configured, and before we have a
|
||||
* preferred input */
|
||||
sch_filter_choke_inputs(fgp->sch, fgp->sch_idx);
|
||||
}
|
||||
|
||||
ret = configure_filtergraph(fg, fgt);
|
||||
@@ -3370,7 +3134,7 @@ static int filter_thread(void *arg)
|
||||
if (ret == AVERROR_EOF) {
|
||||
av_log(fg, AV_LOG_VERBOSE, "Input %u no longer accepts new data\n",
|
||||
input_idx);
|
||||
close_input(ifp);
|
||||
sch_filter_receive_finish(fgp->sch, fgp->sch_idx, input_idx);
|
||||
continue;
|
||||
}
|
||||
if (ret < 0)
|
||||
@@ -3389,13 +3153,6 @@ read_frames:
|
||||
av_err2str(ret));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
// ensure all inputs no longer accepting data are closed
|
||||
for (int i = 0; fgt.graph && i < fg->nb_inputs; i++) {
|
||||
InputFilterPriv *ifp = ifp_from_ifilter(fg->inputs[i]);
|
||||
if (av_buffersrc_get_status(ifp->ifilter.filter))
|
||||
close_input(ifp);
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < fg->nb_outputs; i++) {
|
||||
|
||||
+11
-79
@@ -453,7 +453,7 @@ static int ost_get_filters(const OptionsContext *o, AVFormatContext *oc,
|
||||
}
|
||||
|
||||
if (filters_script)
|
||||
*dst = read_file_to_string(filters_script);
|
||||
*dst = file_read(filters_script);
|
||||
else
|
||||
#endif
|
||||
if (filters)
|
||||
@@ -482,9 +482,9 @@ static int parse_matrix_coeffs(void *logctx, uint16_t *dest, const char *str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pixfmt_in_list(const enum AVPixelFormat *formats, enum AVPixelFormat format)
|
||||
static int fmt_in_list(const int *formats, int format)
|
||||
{
|
||||
for (; *formats != AV_PIX_FMT_NONE; formats++)
|
||||
for (; *formats != -1; formats++)
|
||||
if (*formats == format)
|
||||
return 1;
|
||||
return 0;
|
||||
@@ -544,7 +544,7 @@ static enum AVPixelFormat pix_fmt_parse(OutputStream *ost, const char *name)
|
||||
* endianness by av_get_pix_fmt();
|
||||
* the following code handles the case when the native endianness is not
|
||||
* supported by the encoder, but the other one is */
|
||||
if (fmts && !pixfmt_in_list(fmts, fmt)) {
|
||||
if (fmts && !fmt_in_list(fmts, fmt)) {
|
||||
const char *name_canonical = av_get_pix_fmt_name(fmt);
|
||||
int len = strlen(name_canonical);
|
||||
|
||||
@@ -557,7 +557,7 @@ static enum AVPixelFormat pix_fmt_parse(OutputStream *ost, const char *name)
|
||||
snprintf(name_other, sizeof(name_other), "%s%ce",
|
||||
name, name_canonical[len - 2] == 'l' ? 'b' : 'l');
|
||||
fmt_other = av_get_pix_fmt(name_other);
|
||||
if (fmt_other != AV_PIX_FMT_NONE && pixfmt_in_list(fmts, fmt_other)) {
|
||||
if (fmt_other != AV_PIX_FMT_NONE && fmt_in_list(fmts, fmt_other)) {
|
||||
av_log(ost, AV_LOG_VERBOSE, "Mapping pixel format %s->%s\n",
|
||||
name, name_other);
|
||||
fmt = fmt_other;
|
||||
@@ -565,7 +565,7 @@ static enum AVPixelFormat pix_fmt_parse(OutputStream *ost, const char *name)
|
||||
}
|
||||
}
|
||||
|
||||
if (fmts && !pixfmt_in_list(fmts, fmt))
|
||||
if (fmts && !fmt_in_list(fmts, fmt))
|
||||
fmt = choose_pixel_fmt(ost->enc->enc_ctx, fmt);
|
||||
|
||||
return fmt;
|
||||
@@ -730,14 +730,9 @@ static int new_stream_video(Muxer *mux, const OptionsContext *o,
|
||||
AV_OPT_SEARCH_CHILDREN) > 0)
|
||||
av_opt_set(video_enc, "stats", logfilename,
|
||||
AV_OPT_SEARCH_CHILDREN);
|
||||
} else if (!strcmp(video_enc->codec->name, "libx265")) {
|
||||
if (av_opt_is_set_to_default_by_name(video_enc, "x265-stats",
|
||||
AV_OPT_SEARCH_CHILDREN) > 0)
|
||||
av_opt_set(video_enc, "x265-stats", logfilename,
|
||||
AV_OPT_SEARCH_CHILDREN);
|
||||
} else {
|
||||
if (video_enc->flags & AV_CODEC_FLAG_PASS2) {
|
||||
char *logbuffer = read_file_to_string(logfilename);
|
||||
char *logbuffer = file_read(logfilename);
|
||||
|
||||
if (!logbuffer) {
|
||||
av_log(ost, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n",
|
||||
@@ -922,7 +917,6 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter,
|
||||
.height = enc_ctx->height,
|
||||
.color_space = enc_ctx->colorspace,
|
||||
.color_range = enc_ctx->color_range,
|
||||
.alpha_mode = enc_ctx->alpha_mode,
|
||||
.vsync_method = vsync_method,
|
||||
.frame_rate = ms->frame_rate,
|
||||
.max_frame_rate = ms->max_frame_rate,
|
||||
@@ -949,7 +943,7 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter,
|
||||
if (!keep_pix_fmt) {
|
||||
ret = avcodec_get_supported_config(enc_ctx, NULL,
|
||||
AV_CODEC_CONFIG_PIX_FORMAT, 0,
|
||||
(const void **) &opts.pix_fmts, NULL);
|
||||
(const void **) &opts.formats, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
@@ -970,15 +964,10 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter,
|
||||
(const void **) &opts.color_ranges, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = avcodec_get_supported_config(enc_ctx, NULL,
|
||||
AV_CODEC_CONFIG_ALPHA_MODE, 0,
|
||||
(const void **) &opts.alpha_modes, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
ret = avcodec_get_supported_config(enc_ctx, NULL,
|
||||
AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
|
||||
(const void **) &opts.sample_fmts, NULL);
|
||||
(const void **) &opts.formats, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = avcodec_get_supported_config(enc_ctx, NULL,
|
||||
@@ -1008,7 +997,7 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter,
|
||||
ost->filter = ofilter;
|
||||
ret = ofilter_bind_enc(ofilter, ms->sch_idx_enc, &opts);
|
||||
} else {
|
||||
ret = fg_create_simple(&ost->fg_simple, ost->ist, &filters,
|
||||
ret = fg_create_simple(&ost->fg_simple, ost->ist, filters,
|
||||
mux->sch, ms->sch_idx_enc, &opts);
|
||||
if (ret >= 0)
|
||||
ost->filter = ost->fg_simple->outputs[0];
|
||||
@@ -1603,7 +1592,6 @@ fail:
|
||||
static int map_auto_video(Muxer *mux, const OptionsContext *o)
|
||||
{
|
||||
AVFormatContext *oc = mux->fc;
|
||||
InputStreamGroup *best_istg = NULL;
|
||||
InputStream *best_ist = NULL;
|
||||
int64_t best_score = 0;
|
||||
int qcr;
|
||||
@@ -1615,49 +1603,14 @@ static int map_auto_video(Muxer *mux, const OptionsContext *o)
|
||||
qcr = avformat_query_codec(oc->oformat, oc->oformat->video_codec, 0);
|
||||
for (int j = 0; j < nb_input_files; j++) {
|
||||
InputFile *ifile = input_files[j];
|
||||
InputStreamGroup *file_best_istg = NULL;
|
||||
InputStream *file_best_ist = NULL;
|
||||
int64_t file_best_score = 0;
|
||||
for (int i = 0; i < ifile->nb_stream_groups; i++) {
|
||||
InputStreamGroup *istg = ifile->stream_groups[i];
|
||||
int64_t score = 0;
|
||||
|
||||
if (!istg->fg)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < istg->stg->nb_streams; j++) {
|
||||
AVStream *st = istg->stg->streams[j];
|
||||
|
||||
if (st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS) {
|
||||
score = 100000000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (istg->stg->type) {
|
||||
case AV_STREAM_GROUP_PARAMS_TILE_GRID: {
|
||||
const AVStreamGroupTileGrid *tg = istg->stg->params.tile_grid;
|
||||
score += tg->width * (int64_t)tg->height
|
||||
+ 5000000*!!(istg->stg->disposition & AV_DISPOSITION_DEFAULT);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
if (score > file_best_score) {
|
||||
file_best_score = score;
|
||||
file_best_istg = istg;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < ifile->nb_streams; i++) {
|
||||
InputStream *ist = ifile->streams[i];
|
||||
const AVCodecDescriptor *desc = avcodec_descriptor_get(ist->st->codecpar->codec_id);
|
||||
int64_t score;
|
||||
|
||||
if (ist->user_set_discard == AVDISCARD_ALL ||
|
||||
ist->st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ||
|
||||
(desc && (desc->props & AV_CODEC_PROP_ENHANCEMENT)))
|
||||
ist->st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO)
|
||||
continue;
|
||||
|
||||
score = ist->st->codecpar->width * (int64_t)ist->st->codecpar->height
|
||||
@@ -1671,15 +1624,6 @@ static int map_auto_video(Muxer *mux, const OptionsContext *o)
|
||||
continue;
|
||||
file_best_score = score;
|
||||
file_best_ist = ist;
|
||||
file_best_istg = NULL;
|
||||
}
|
||||
}
|
||||
if (file_best_istg) {
|
||||
file_best_score -= 5000000*!!(file_best_istg->stg->disposition & AV_DISPOSITION_DEFAULT);
|
||||
if (file_best_score > best_score) {
|
||||
best_score = file_best_score;
|
||||
best_istg = file_best_istg;
|
||||
best_ist = NULL;
|
||||
}
|
||||
}
|
||||
if (file_best_ist) {
|
||||
@@ -1689,19 +1633,9 @@ static int map_auto_video(Muxer *mux, const OptionsContext *o)
|
||||
if (file_best_score > best_score) {
|
||||
best_score = file_best_score;
|
||||
best_ist = file_best_ist;
|
||||
best_istg = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (best_istg) {
|
||||
FilterGraph *fg = best_istg->fg;
|
||||
OutputFilter *ofilter = fg->outputs[0];
|
||||
|
||||
av_assert0(fg->nb_outputs == 1);
|
||||
av_log(mux, AV_LOG_VERBOSE, "Creating output stream from stream group derived complex filtergraph %d.\n", fg->index);
|
||||
|
||||
return ost_add(mux, o, AVMEDIA_TYPE_VIDEO, NULL, ofilter, NULL, NULL);
|
||||
}
|
||||
if (best_ist)
|
||||
return ost_add(mux, o, AVMEDIA_TYPE_VIDEO, best_ist, NULL, NULL, NULL);
|
||||
|
||||
@@ -3286,8 +3220,6 @@ static int process_forced_keyframes(Muxer *mux, const OptionsContext *o)
|
||||
"-force_key_frames is deprecated, use just 'source'\n");
|
||||
ost->kf.type = KF_FORCE_SOURCE;
|
||||
#endif
|
||||
} else if (!strcmp(forced_keyframes, "scd_metadata")) {
|
||||
ost->kf.type = KF_FORCE_SCD_METADATA;
|
||||
} else {
|
||||
int ret = parse_forced_key_frames(ost, &ost->kf, mux, forced_keyframes);
|
||||
if (ret < 0)
|
||||
|
||||
+4
-102
@@ -242,70 +242,6 @@ OPT_MATCH_PER_STREAM(int, int, OPT_TYPE_INT, i);
|
||||
OPT_MATCH_PER_STREAM(int64, int64_t, OPT_TYPE_INT64, i64);
|
||||
OPT_MATCH_PER_STREAM(dbl, double, OPT_TYPE_DOUBLE, dbl);
|
||||
|
||||
static unsigned opt_match_per_stream_group(void *logctx, enum OptionType type,
|
||||
const SpecifierOptList *sol,
|
||||
AVFormatContext *fc, AVStreamGroup *stg)
|
||||
{
|
||||
int matches = 0, match_idx = -1;
|
||||
|
||||
av_assert0((type == sol->type) || !sol->nb_opt);
|
||||
|
||||
for (int i = 0; i < sol->nb_opt; i++) {
|
||||
const StreamSpecifier *ss = &sol->opt[i].stream_spec;
|
||||
|
||||
if (stream_group_specifier_match(ss, fc, stg, logctx)) {
|
||||
match_idx = i;
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
|
||||
if (matches > 1 && sol->opt_canon) {
|
||||
const SpecifierOpt *so = &sol->opt[match_idx];
|
||||
const char *spec = so->specifier && so->specifier[0] ? so->specifier : "";
|
||||
|
||||
char namestr[128] = "";
|
||||
char optval_buf[32];
|
||||
const char *optval = optval_buf;
|
||||
|
||||
snprintf(namestr, sizeof(namestr), "-%s", sol->opt_canon->name);
|
||||
if (sol->opt_canon->flags & OPT_HAS_ALT) {
|
||||
const char * const *names_alt = sol->opt_canon->u1.names_alt;
|
||||
for (int i = 0; names_alt[i]; i++)
|
||||
av_strlcatf(namestr, sizeof(namestr), "/-%s", names_alt[i]);
|
||||
}
|
||||
|
||||
switch (sol->type) {
|
||||
case OPT_TYPE_STRING: optval = so->u.str; break;
|
||||
case OPT_TYPE_INT: snprintf(optval_buf, sizeof(optval_buf), "%d", so->u.i); break;
|
||||
case OPT_TYPE_INT64: snprintf(optval_buf, sizeof(optval_buf), "%"PRId64, so->u.i64); break;
|
||||
case OPT_TYPE_FLOAT: snprintf(optval_buf, sizeof(optval_buf), "%f", so->u.f); break;
|
||||
case OPT_TYPE_DOUBLE: snprintf(optval_buf, sizeof(optval_buf), "%f", so->u.dbl); break;
|
||||
default: av_assert0(0);
|
||||
}
|
||||
|
||||
av_log(logctx, AV_LOG_WARNING, "Multiple %s options specified for "
|
||||
"stream group %d, only the last option '-%s%s%s %s' will be used.\n",
|
||||
namestr, stg->index, sol->opt_canon->name, spec[0] ? ":" : "",
|
||||
spec, optval);
|
||||
}
|
||||
|
||||
return match_idx + 1;
|
||||
}
|
||||
|
||||
#define OPT_MATCH_PER_STREAM_GROUP(name, type, opt_type, m) \
|
||||
void opt_match_per_stream_group_ ## name(void *logctx, const SpecifierOptList *sol, \
|
||||
AVFormatContext *fc, AVStreamGroup *stg, type *out) \
|
||||
{ \
|
||||
unsigned ret = opt_match_per_stream_group(logctx, opt_type, sol, fc, stg); \
|
||||
if (ret > 0) \
|
||||
*out = sol->opt[ret - 1].u.m; \
|
||||
}
|
||||
|
||||
OPT_MATCH_PER_STREAM_GROUP(str, const char *, OPT_TYPE_STRING, str);
|
||||
OPT_MATCH_PER_STREAM_GROUP(int, int, OPT_TYPE_INT, i);
|
||||
OPT_MATCH_PER_STREAM_GROUP(int64, int64_t, OPT_TYPE_INT64, i64);
|
||||
OPT_MATCH_PER_STREAM_GROUP(dbl, double, OPT_TYPE_DOUBLE, dbl);
|
||||
|
||||
int view_specifier_parse(const char **pspec, ViewSpecifier *vs)
|
||||
{
|
||||
const char *spec = *pspec;
|
||||
@@ -359,7 +295,7 @@ int view_specifier_parse(const char **pspec, ViewSpecifier *vs)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int parse_and_set_vsync(const char *arg, enum VideoSyncMethod *vsync_var, int file_idx, int st_idx, int is_global)
|
||||
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global)
|
||||
{
|
||||
if (!av_strcasecmp(arg, "cfr")) *vsync_var = VSYNC_CFR;
|
||||
else if (!av_strcasecmp(arg, "vfr")) *vsync_var = VSYNC_VFR;
|
||||
@@ -568,10 +504,8 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
|
||||
}
|
||||
|
||||
if (arg[0] == '[') {
|
||||
ViewSpecifier vs;
|
||||
/* this mapping refers to lavfi output */
|
||||
const char *c = arg + 1;
|
||||
char *endptr;
|
||||
|
||||
ret = GROW_ARRAY(o->stream_maps, o->nb_stream_maps);
|
||||
if (ret < 0)
|
||||
@@ -584,27 +518,6 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
arg++;
|
||||
|
||||
m->group_index = -1;
|
||||
file_idx = strtol(arg, &endptr, 0);
|
||||
if (file_idx >= nb_input_files || file_idx < 0)
|
||||
goto end;
|
||||
|
||||
arg = endptr;
|
||||
ret = stream_specifier_parse(&ss, *arg == ':' ? arg + 1 : arg, 1, NULL);
|
||||
if (ret < 0)
|
||||
goto end;
|
||||
|
||||
arg = ss.remainder ? ss.remainder : "";
|
||||
ret = view_specifier_parse(&arg, &vs);
|
||||
if (ret < 0 || (*arg && strcmp(arg, "]")))
|
||||
goto end;
|
||||
|
||||
m->file_index = file_idx;
|
||||
m->stream_index = ss.idx;
|
||||
m->group_index = ss.stream_list == STREAM_LIST_GROUP_IDX ? ss.list_id : -1;
|
||||
} else {
|
||||
ViewSpecifier vs;
|
||||
char *endptr;
|
||||
@@ -670,7 +583,6 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
|
||||
|
||||
m->file_index = file_idx;
|
||||
m->stream_index = i;
|
||||
m->group_index = ss.stream_list == STREAM_LIST_GROUP_IDX ? ss.list_id : -1;
|
||||
m->vs = vs;
|
||||
}
|
||||
}
|
||||
@@ -690,7 +602,6 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
end:
|
||||
ret = 0;
|
||||
fail:
|
||||
stream_specifier_uninit(&ss);
|
||||
@@ -1110,12 +1021,6 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
|
||||
char filename[1000], line[1000], tmp_line[1000];
|
||||
const char *codec_name = NULL;
|
||||
int ret = 0;
|
||||
int depth = o->depth;
|
||||
|
||||
if (depth > 2) {
|
||||
av_log(NULL, AV_LOG_ERROR, "too deep recursion\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
codec_name = opt_match_per_type_str(&o->codec_names, *opt);
|
||||
|
||||
@@ -1127,7 +1032,6 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
|
||||
return AVERROR(ENOENT);
|
||||
}
|
||||
|
||||
o->depth ++;
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
char *key = tmp_line, *value, *endptr;
|
||||
|
||||
@@ -1146,8 +1050,7 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
|
||||
else if (!strcmp(key, "vcodec")) opt_video_codec (o, key, value);
|
||||
else if (!strcmp(key, "scodec")) opt_subtitle_codec(o, key, value);
|
||||
else if (!strcmp(key, "dcodec")) opt_data_codec (o, key, value);
|
||||
else if ((parse_option(o, key, value, options) < 0) &&
|
||||
(opt_default_new(o, key, value) < 0)) {
|
||||
else if (opt_default_new(o, key, value) < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n",
|
||||
filename, line, key, value);
|
||||
ret = AVERROR(EINVAL);
|
||||
@@ -1156,7 +1059,6 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
|
||||
}
|
||||
|
||||
fail:
|
||||
o->depth = depth;
|
||||
fclose(f);
|
||||
|
||||
return ret;
|
||||
@@ -1286,7 +1188,7 @@ static int opt_filter_complex_script(void *optctx, const char *opt, const char *
|
||||
char *graph_desc;
|
||||
int ret;
|
||||
|
||||
graph_desc = read_file_to_string(arg);
|
||||
graph_desc = file_read(arg);
|
||||
if (!graph_desc)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
@@ -1504,7 +1406,7 @@ int ffmpeg_parse_options(int argc, char **argv, Scheduler *sch)
|
||||
|
||||
/* create complex filtergraphs */
|
||||
for (int i = 0; i < go.nb_filtergraphs; i++) {
|
||||
ret = fg_create(NULL, &go.filtergraphs[i], sch, NULL);
|
||||
ret = fg_create(NULL, go.filtergraphs[i], sch);
|
||||
go.filtergraphs[i] = NULL;
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
+60
-205
@@ -189,6 +189,7 @@ typedef struct PreMuxQueue {
|
||||
|
||||
typedef struct SchMuxStream {
|
||||
SchedulerNode src;
|
||||
SchedulerNode src_sched;
|
||||
|
||||
unsigned *sub_heartbeat_dst;
|
||||
unsigned nb_sub_heartbeat_dst;
|
||||
@@ -234,6 +235,7 @@ typedef struct SchMux {
|
||||
|
||||
typedef struct SchFilterIn {
|
||||
SchedulerNode src;
|
||||
SchedulerNode src_sched;
|
||||
int send_finished;
|
||||
int receive_finished;
|
||||
} SchFilterIn;
|
||||
@@ -247,7 +249,7 @@ typedef struct SchFilterGraph {
|
||||
|
||||
SchFilterIn *inputs;
|
||||
unsigned nb_inputs;
|
||||
unsigned nb_inputs_finished_send;
|
||||
atomic_uint nb_inputs_finished_send;
|
||||
unsigned nb_inputs_finished_receive;
|
||||
|
||||
SchFilterOut *outputs;
|
||||
@@ -387,7 +389,7 @@ static int queue_alloc(ThreadQueue **ptq, unsigned nb_streams, unsigned queue_si
|
||||
// for frames held in queues inside the ffmpeg utility. If this
|
||||
// can ever dynamically change then the corresponding decode
|
||||
// code needs to be updated as well.
|
||||
av_assert0(queue_size <= DEFAULT_FRAME_THREAD_QUEUE_SIZE);
|
||||
av_assert0(queue_size == DEFAULT_FRAME_THREAD_QUEUE_SIZE);
|
||||
}
|
||||
|
||||
tq = tq_alloc(nb_streams, queue_size,
|
||||
@@ -405,9 +407,6 @@ static int task_start(SchTask *task)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!task->parent)
|
||||
return 0;
|
||||
|
||||
av_log(task->func_arg, AV_LOG_VERBOSE, "Starting thread...\n");
|
||||
|
||||
av_assert0(!task->thread_running);
|
||||
@@ -457,23 +456,6 @@ static int64_t trailing_dts(const Scheduler *sch, int count_finished)
|
||||
return min_dts == INT64_MAX ? AV_NOPTS_VALUE : min_dts;
|
||||
}
|
||||
|
||||
void sch_remove_filtergraph(Scheduler *sch, int idx)
|
||||
{
|
||||
SchFilterGraph *fg = &sch->filters[idx];
|
||||
|
||||
av_assert0(!fg->task.thread_running);
|
||||
memset(&fg->task, 0, sizeof(fg->task));
|
||||
|
||||
tq_free(&fg->queue);
|
||||
|
||||
av_freep(&fg->inputs);
|
||||
fg->nb_inputs = 0;
|
||||
av_freep(&fg->outputs);
|
||||
fg->nb_outputs = 0;
|
||||
|
||||
fg->task_exited = 1;
|
||||
}
|
||||
|
||||
void sch_free(Scheduler **psch)
|
||||
{
|
||||
Scheduler *sch = *psch;
|
||||
@@ -1282,110 +1264,28 @@ int sch_mux_sub_heartbeat_add(Scheduler *sch, unsigned mux_idx, unsigned stream_
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void unchoke_for_stream(Scheduler *sch, SchedulerNode src);
|
||||
|
||||
// Unchoke any filter graphs that are downstream of this node, to prevent it
|
||||
// from getting stuck trying to push data to a full queue
|
||||
static void unchoke_downstream(Scheduler *sch, SchedulerNode *dst)
|
||||
{
|
||||
SchFilterGraph *fg;
|
||||
SchDec *dec;
|
||||
SchEnc *enc;
|
||||
switch (dst->type) {
|
||||
case SCH_NODE_TYPE_DEC:
|
||||
dec = &sch->dec[dst->idx];
|
||||
for (int i = 0; i < dec->nb_outputs; i++)
|
||||
unchoke_downstream(sch, dec->outputs[i].dst);
|
||||
break;
|
||||
case SCH_NODE_TYPE_ENC:
|
||||
enc = &sch->enc[dst->idx];
|
||||
for (int i = 0; i < enc->nb_dst; i++)
|
||||
unchoke_downstream(sch, &enc->dst[i]);
|
||||
break;
|
||||
case SCH_NODE_TYPE_MUX:
|
||||
// muxers are never choked
|
||||
break;
|
||||
case SCH_NODE_TYPE_FILTER_IN:
|
||||
fg = &sch->filters[dst->idx];
|
||||
if (fg->best_input == fg->nb_inputs) {
|
||||
fg->waiter.choked_next = 0;
|
||||
} else {
|
||||
// ensure that this filter graph is not stuck waiting for
|
||||
// input from a different upstream demuxer
|
||||
unchoke_for_stream(sch, fg->inputs[fg->best_input].src);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
av_unreachable("Invalid destination node type?");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void unchoke_for_stream(Scheduler *sch, SchedulerNode src)
|
||||
{
|
||||
while (1) {
|
||||
SchFilterGraph *fg;
|
||||
SchDemux *demux;
|
||||
switch (src.type) {
|
||||
case SCH_NODE_TYPE_DEMUX:
|
||||
// fed directly by a demuxer (i.e. not through a filtergraph)
|
||||
demux = &sch->demux[src.idx];
|
||||
if (demux->waiter.choked_next == 0)
|
||||
return; // prevent infinite loop
|
||||
demux->waiter.choked_next = 0;
|
||||
for (int i = 0; i < demux->nb_streams; i++)
|
||||
unchoke_downstream(sch, demux->streams[i].dst);
|
||||
return;
|
||||
case SCH_NODE_TYPE_DEC:
|
||||
src = sch->dec[src.idx].src;
|
||||
continue;
|
||||
case SCH_NODE_TYPE_ENC:
|
||||
src = sch->enc[src.idx].src;
|
||||
continue;
|
||||
case SCH_NODE_TYPE_FILTER_OUT:
|
||||
fg = &sch->filters[src.idx];
|
||||
// the filtergraph contains internal sources and
|
||||
// requested to be scheduled directly
|
||||
if (fg->best_input == fg->nb_inputs) {
|
||||
fg->waiter.choked_next = 0;
|
||||
return;
|
||||
}
|
||||
src = fg->inputs[fg->best_input].src;
|
||||
continue;
|
||||
default:
|
||||
av_unreachable("Invalid source node type?");
|
||||
|
||||
// fed directly by a demuxer (i.e. not through a filtergraph)
|
||||
if (src.type == SCH_NODE_TYPE_DEMUX) {
|
||||
sch->demux[src.idx].waiter.choked_next = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void choke_demux(const Scheduler *sch, int demux_id, int choked)
|
||||
{
|
||||
av_assert1(demux_id < sch->nb_demux);
|
||||
SchDemux *demux = &sch->demux[demux_id];
|
||||
av_assert0(src.type == SCH_NODE_TYPE_FILTER_OUT);
|
||||
fg = &sch->filters[src.idx];
|
||||
|
||||
for (int i = 0; i < demux->nb_streams; i++) {
|
||||
SchedulerNode *dst = demux->streams[i].dst;
|
||||
SchFilterGraph *fg;
|
||||
|
||||
switch (dst->type) {
|
||||
case SCH_NODE_TYPE_DEC:
|
||||
tq_choke(sch->dec[dst->idx].queue, choked);
|
||||
break;
|
||||
case SCH_NODE_TYPE_ENC:
|
||||
tq_choke(sch->enc[dst->idx].queue, choked);
|
||||
break;
|
||||
case SCH_NODE_TYPE_MUX:
|
||||
break;
|
||||
case SCH_NODE_TYPE_FILTER_IN:
|
||||
fg = &sch->filters[dst->idx];
|
||||
if (fg->nb_inputs == 1)
|
||||
tq_choke(fg->queue, choked);
|
||||
break;
|
||||
default:
|
||||
av_unreachable("Invalid destination node type?");
|
||||
break;
|
||||
// the filtergraph contains internal sources and
|
||||
// requested to be scheduled directly
|
||||
if (fg->best_input == fg->nb_inputs) {
|
||||
fg->waiter.choked_next = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
src = fg->inputs[fg->best_input].src_sched;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1428,23 +1328,11 @@ static void schedule_update_locked(Scheduler *sch)
|
||||
continue;
|
||||
|
||||
// resolve the source to unchoke
|
||||
unchoke_for_stream(sch, ms->src);
|
||||
unchoke_for_stream(sch, ms->src_sched);
|
||||
have_unchoked = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// also unchoke any sources feeding into closed filter graph inputs, so
|
||||
// that they can observe the downstream EOF
|
||||
for (unsigned i = 0; i < sch->nb_filters; i++) {
|
||||
SchFilterGraph *fg = &sch->filters[i];
|
||||
|
||||
for (unsigned j = 0; j < fg->nb_inputs; j++) {
|
||||
SchFilterIn *fi = &fg->inputs[j];
|
||||
if (fi->receive_finished && !fi->send_finished)
|
||||
unchoke_for_stream(sch, fi->src);
|
||||
}
|
||||
}
|
||||
|
||||
// make sure to unchoke at least one source, if still available
|
||||
for (unsigned type = 0; !have_unchoked && type < 2; type++)
|
||||
for (unsigned i = 0; i < (type ? sch->nb_filters : sch->nb_demux); i++) {
|
||||
@@ -1457,16 +1345,13 @@ static void schedule_update_locked(Scheduler *sch)
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned type = 0; type < 2; type++) {
|
||||
|
||||
for (unsigned type = 0; type < 2; type++)
|
||||
for (unsigned i = 0; i < (type ? sch->nb_filters : sch->nb_demux); i++) {
|
||||
SchWaiter *w = type ? &sch->filters[i].waiter : &sch->demux[i].waiter;
|
||||
if (w->choked_prev != w->choked_next) {
|
||||
if (w->choked_prev != w->choked_next)
|
||||
waiter_set(w, w->choked_next);
|
||||
if (!type)
|
||||
choke_demux(sch, i, w->choked_next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1476,27 +1361,6 @@ enum {
|
||||
CYCLE_NODE_DONE,
|
||||
};
|
||||
|
||||
// Finds the filtergraph or muxer upstream of a scheduler node
|
||||
static SchedulerNode src_filtergraph(const Scheduler *sch, SchedulerNode src)
|
||||
{
|
||||
while (1) {
|
||||
switch (src.type) {
|
||||
case SCH_NODE_TYPE_DEMUX:
|
||||
case SCH_NODE_TYPE_FILTER_OUT:
|
||||
return src;
|
||||
case SCH_NODE_TYPE_DEC:
|
||||
src = sch->dec[src.idx].src;
|
||||
continue;
|
||||
case SCH_NODE_TYPE_ENC:
|
||||
src = sch->enc[src.idx].src;
|
||||
continue;
|
||||
default:
|
||||
av_unreachable("Invalid source node type?");
|
||||
return (SchedulerNode) {0};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
check_acyclic_for_output(const Scheduler *sch, SchedulerNode src,
|
||||
uint8_t *filters_visited, SchedulerNode *filters_stack)
|
||||
@@ -1513,23 +1377,22 @@ check_acyclic_for_output(const Scheduler *sch, SchedulerNode src,
|
||||
// descend into every input, depth first
|
||||
if (src.idx_stream < fg->nb_inputs) {
|
||||
const SchFilterIn *fi = &fg->inputs[src.idx_stream++];
|
||||
SchedulerNode node = src_filtergraph(sch, fi->src);
|
||||
|
||||
// connected to demuxer, no cycles possible
|
||||
if (node.type == SCH_NODE_TYPE_DEMUX)
|
||||
if (fi->src_sched.type == SCH_NODE_TYPE_DEMUX)
|
||||
continue;
|
||||
|
||||
// otherwise connected to another filtergraph
|
||||
av_assert0(node.type == SCH_NODE_TYPE_FILTER_OUT);
|
||||
av_assert0(fi->src_sched.type == SCH_NODE_TYPE_FILTER_OUT);
|
||||
|
||||
// found a cycle
|
||||
if (filters_visited[node.idx] == CYCLE_NODE_STARTED)
|
||||
if (filters_visited[fi->src_sched.idx] == CYCLE_NODE_STARTED)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
// place current position on stack and descend
|
||||
av_assert0(nb_filters_stack < sch->nb_filters);
|
||||
filters_stack[nb_filters_stack++] = src;
|
||||
src = (SchedulerNode){ .idx = node.idx, .idx_stream = 0 };
|
||||
src = (SchedulerNode){ .idx = fi->src_sched.idx, .idx_stream = 0 };
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1651,7 +1514,22 @@ static int start_prepare(Scheduler *sch)
|
||||
for (unsigned j = 0; j < mux->nb_streams; j++) {
|
||||
SchMuxStream *ms = &mux->streams[j];
|
||||
|
||||
if (!ms->src.type) {
|
||||
switch (ms->src.type) {
|
||||
case SCH_NODE_TYPE_ENC: {
|
||||
SchEnc *enc = &sch->enc[ms->src.idx];
|
||||
if (enc->src.type == SCH_NODE_TYPE_DEC) {
|
||||
ms->src_sched = sch->dec[enc->src.idx].src;
|
||||
av_assert0(ms->src_sched.type == SCH_NODE_TYPE_DEMUX);
|
||||
} else {
|
||||
ms->src_sched = enc->src;
|
||||
av_assert0(ms->src_sched.type == SCH_NODE_TYPE_FILTER_OUT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCH_NODE_TYPE_DEMUX:
|
||||
ms->src_sched = ms->src;
|
||||
break;
|
||||
default:
|
||||
av_log(mux, AV_LOG_ERROR,
|
||||
"Muxer stream #%u not connected to a source\n", j);
|
||||
return AVERROR(EINVAL);
|
||||
@@ -1669,12 +1547,26 @@ static int start_prepare(Scheduler *sch)
|
||||
|
||||
for (unsigned j = 0; j < fg->nb_inputs; j++) {
|
||||
SchFilterIn *fi = &fg->inputs[j];
|
||||
SchDec *dec;
|
||||
|
||||
if (!fi->src.type) {
|
||||
av_log(fg, AV_LOG_ERROR,
|
||||
"Filtergraph input %u not connected to a source\n", j);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (fi->src.type == SCH_NODE_TYPE_FILTER_OUT)
|
||||
fi->src_sched = fi->src;
|
||||
else {
|
||||
av_assert0(fi->src.type == SCH_NODE_TYPE_DEC);
|
||||
dec = &sch->dec[fi->src.idx];
|
||||
|
||||
switch (dec->src.type) {
|
||||
case SCH_NODE_TYPE_DEMUX: fi->src_sched = dec->src; break;
|
||||
case SCH_NODE_TYPE_ENC: fi->src_sched = sch->enc[dec->src.idx].src; break;
|
||||
default: av_assert0(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned j = 0; j < fg->nb_outputs; j++) {
|
||||
@@ -2297,20 +2189,14 @@ static int send_to_filter(Scheduler *sch, SchFilterGraph *fg,
|
||||
if (frame)
|
||||
return tq_send(fg->queue, in_idx, frame);
|
||||
|
||||
pthread_mutex_lock(&sch->schedule_lock);
|
||||
|
||||
if (!fg->inputs[in_idx].send_finished) {
|
||||
fg->inputs[in_idx].send_finished = 1;
|
||||
tq_send_finish(fg->queue, in_idx);
|
||||
|
||||
// close the control stream when all actual inputs are done
|
||||
if (++fg->nb_inputs_finished_send == fg->nb_inputs)
|
||||
if (atomic_fetch_add(&fg->nb_inputs_finished_send, 1) == fg->nb_inputs - 1)
|
||||
tq_send_finish(fg->queue, fg->nb_inputs);
|
||||
|
||||
schedule_update_locked(sch);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&sch->schedule_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2561,8 +2447,6 @@ void sch_filter_receive_finish(Scheduler *sch, unsigned fg_idx, unsigned in_idx)
|
||||
av_assert0(in_idx < fg->nb_inputs);
|
||||
fi = &fg->inputs[in_idx];
|
||||
|
||||
pthread_mutex_lock(&sch->schedule_lock);
|
||||
|
||||
if (!fi->receive_finished) {
|
||||
fi->receive_finished = 1;
|
||||
tq_receive_finish(fg->queue, in_idx);
|
||||
@@ -2570,18 +2454,13 @@ void sch_filter_receive_finish(Scheduler *sch, unsigned fg_idx, unsigned in_idx)
|
||||
// close the control stream when all actual inputs are done
|
||||
if (++fg->nb_inputs_finished_receive == fg->nb_inputs)
|
||||
tq_receive_finish(fg->queue, fg->nb_inputs);
|
||||
|
||||
schedule_update_locked(sch);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&sch->schedule_lock);
|
||||
}
|
||||
|
||||
int sch_filter_send(Scheduler *sch, unsigned fg_idx, unsigned out_idx, AVFrame *frame)
|
||||
{
|
||||
SchFilterGraph *fg;
|
||||
SchedulerNode dst;
|
||||
int ret;
|
||||
|
||||
av_assert0(fg_idx < sch->nb_filters);
|
||||
fg = &sch->filters[fg_idx];
|
||||
@@ -2589,16 +2468,9 @@ int sch_filter_send(Scheduler *sch, unsigned fg_idx, unsigned out_idx, AVFrame *
|
||||
av_assert0(out_idx < fg->nb_outputs);
|
||||
dst = fg->outputs[out_idx].dst;
|
||||
|
||||
if (dst.type == SCH_NODE_TYPE_ENC) {
|
||||
ret = send_to_enc(sch, &sch->enc[dst.idx], frame);
|
||||
if (ret == AVERROR_EOF)
|
||||
send_to_enc(sch, &sch->enc[dst.idx], NULL);
|
||||
} else {
|
||||
ret = send_to_filter(sch, &sch->filters[dst.idx], dst.idx_stream, frame);
|
||||
if (ret == AVERROR_EOF)
|
||||
send_to_filter(sch, &sch->filters[dst.idx], dst.idx_stream, NULL);
|
||||
}
|
||||
return ret;
|
||||
return (dst.type == SCH_NODE_TYPE_ENC) ?
|
||||
send_to_enc (sch, &sch->enc[dst.idx], frame) :
|
||||
send_to_filter(sch, &sch->filters[dst.idx], dst.idx_stream, frame);
|
||||
}
|
||||
|
||||
static int filter_done(Scheduler *sch, unsigned fg_idx)
|
||||
@@ -2640,18 +2512,6 @@ int sch_filter_command(Scheduler *sch, unsigned fg_idx, AVFrame *frame)
|
||||
return send_to_filter(sch, fg, fg->nb_inputs, frame);
|
||||
}
|
||||
|
||||
void sch_filter_choke_inputs(Scheduler *sch, unsigned fg_idx)
|
||||
{
|
||||
SchFilterGraph *fg;
|
||||
av_assert0(fg_idx < sch->nb_filters);
|
||||
fg = &sch->filters[fg_idx];
|
||||
|
||||
pthread_mutex_lock(&sch->schedule_lock);
|
||||
fg->best_input = fg->nb_inputs;
|
||||
schedule_update_locked(sch);
|
||||
pthread_mutex_unlock(&sch->schedule_lock);
|
||||
}
|
||||
|
||||
static int task_cleanup(Scheduler *sch, SchedulerNode node)
|
||||
{
|
||||
switch (node.type) {
|
||||
@@ -2660,7 +2520,7 @@ static int task_cleanup(Scheduler *sch, SchedulerNode node)
|
||||
case SCH_NODE_TYPE_DEC: return dec_done (sch, node.idx);
|
||||
case SCH_NODE_TYPE_ENC: return enc_done (sch, node.idx);
|
||||
case SCH_NODE_TYPE_FILTER_IN: return filter_done(sch, node.idx);
|
||||
default: av_unreachable("Invalid node type?");
|
||||
default: av_assert0(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2701,9 +2561,6 @@ static int task_stop(Scheduler *sch, SchTask *task)
|
||||
int ret;
|
||||
void *thread_ret;
|
||||
|
||||
if (!task->parent)
|
||||
return 0;
|
||||
|
||||
if (!task->thread_running)
|
||||
return task_cleanup(sch, task->node);
|
||||
|
||||
@@ -2728,8 +2585,6 @@ int sch_stop(Scheduler *sch, int64_t *finish_ts)
|
||||
for (unsigned i = 0; i < (type ? sch->nb_demux : sch->nb_filters); i++) {
|
||||
SchWaiter *w = type ? &sch->demux[i].waiter : &sch->filters[i].waiter;
|
||||
waiter_set(w, 1);
|
||||
if (type)
|
||||
choke_demux(sch, i, 0); // unfreeze to allow draining
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < sch->nb_demux; i++) {
|
||||
|
||||
+1
-10
@@ -205,8 +205,6 @@ int sch_add_dec_output(Scheduler *sch, unsigned dec_idx);
|
||||
int sch_add_filtergraph(Scheduler *sch, unsigned nb_inputs, unsigned nb_outputs,
|
||||
SchThreadFunc func, void *ctx);
|
||||
|
||||
void sch_remove_filtergraph(Scheduler *sch, int idx);
|
||||
|
||||
/**
|
||||
* Add a muxer to the scheduler.
|
||||
*
|
||||
@@ -259,7 +257,7 @@ int sch_add_mux(Scheduler *sch, SchThreadFunc func, int (*init)(void *),
|
||||
/**
|
||||
* Default size of a frame thread queue.
|
||||
*/
|
||||
#define DEFAULT_FRAME_THREAD_QUEUE_SIZE 2
|
||||
#define DEFAULT_FRAME_THREAD_QUEUE_SIZE 8
|
||||
|
||||
/**
|
||||
* Add a muxed stream for a previously added muxer.
|
||||
@@ -445,13 +443,6 @@ int sch_filter_send(Scheduler *sch, unsigned fg_idx, unsigned out_idx,
|
||||
|
||||
int sch_filter_command(Scheduler *sch, unsigned fg_idx, struct AVFrame *frame);
|
||||
|
||||
/**
|
||||
* Called by filtergraph tasks to choke all filter inputs, preventing them from
|
||||
* receiving more frames until woken up again by the scheduler. Used during
|
||||
* initial graph configuration to avoid unnecessary buffering.
|
||||
*/
|
||||
void sch_filter_choke_inputs(Scheduler *sch, unsigned fg_idx);
|
||||
|
||||
/**
|
||||
* Called by encoder tasks to obtain frames for encoding. Will wait for a frame
|
||||
* to become available and return it in frame.
|
||||
|
||||
+10
-91
@@ -37,7 +37,6 @@
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/fifo.h"
|
||||
#include "libavutil/parseutils.h"
|
||||
#include "libavutil/samplefmt.h"
|
||||
#include "libavutil/time.h"
|
||||
#include "libavutil/bprint.h"
|
||||
@@ -268,7 +267,6 @@ typedef struct VideoState {
|
||||
AVComplexFloat *rdft_data;
|
||||
int xpos;
|
||||
double last_vis_time;
|
||||
RenderParams render_params;
|
||||
SDL_Texture *vis_texture;
|
||||
SDL_Texture *sub_texture;
|
||||
SDL_Texture *vid_texture;
|
||||
@@ -352,7 +350,6 @@ static int find_stream_info = 1;
|
||||
static int filter_nbthreads = 0;
|
||||
static int enable_vulkan = 0;
|
||||
static char *vulkan_params = NULL;
|
||||
static char *video_background = NULL;
|
||||
static const char *hwaccel = NULL;
|
||||
|
||||
/* current context */
|
||||
@@ -945,11 +942,6 @@ static enum AVColorSpace sdl_supported_color_spaces[] = {
|
||||
AVCOL_SPC_SMPTE170M,
|
||||
};
|
||||
|
||||
static enum AVAlphaMode sdl_supported_alpha_modes[] = {
|
||||
AVALPHA_MODE_UNSPECIFIED,
|
||||
AVALPHA_MODE_STRAIGHT,
|
||||
};
|
||||
|
||||
static void set_sdl_yuv_conversion_mode(AVFrame *frame)
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2,0,8)
|
||||
@@ -966,52 +958,15 @@ static void set_sdl_yuv_conversion_mode(AVFrame *frame)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void draw_video_background(VideoState *is)
|
||||
{
|
||||
const int tile_size = VIDEO_BACKGROUND_TILE_SIZE;
|
||||
SDL_Rect *rect = &is->render_params.target_rect;
|
||||
SDL_BlendMode blendMode;
|
||||
|
||||
if (!SDL_GetTextureBlendMode(is->vid_texture, &blendMode) && blendMode == SDL_BLENDMODE_BLEND) {
|
||||
switch (is->render_params.video_background_type) {
|
||||
case VIDEO_BACKGROUND_TILES:
|
||||
SDL_SetRenderDrawColor(renderer, 237, 237, 237, 255);
|
||||
fill_rectangle(rect->x, rect->y, rect->w, rect->h);
|
||||
SDL_SetRenderDrawColor(renderer, 222, 222, 222, 255);
|
||||
for (int x = 0; x < rect->w; x += tile_size * 2)
|
||||
fill_rectangle(rect->x + x, rect->y, FFMIN(tile_size, rect->w - x), rect->h);
|
||||
for (int y = 0; y < rect->h; y += tile_size * 2)
|
||||
fill_rectangle(rect->x, rect->y + y, rect->w, FFMIN(tile_size, rect->h - y));
|
||||
SDL_SetRenderDrawColor(renderer, 237, 237, 237, 255);
|
||||
for (int y = 0; y < rect->h; y += tile_size * 2) {
|
||||
int h = FFMIN(tile_size, rect->h - y);
|
||||
for (int x = 0; x < rect->w; x += tile_size * 2)
|
||||
fill_rectangle(x + rect->x, y + rect->y, FFMIN(tile_size, rect->w - x), h);
|
||||
}
|
||||
break;
|
||||
case VIDEO_BACKGROUND_COLOR: {
|
||||
const uint8_t *c = is->render_params.video_background_color;
|
||||
SDL_SetRenderDrawColor(renderer, c[0], c[1], c[2], c[3]);
|
||||
fill_rectangle(rect->x, rect->y, rect->w, rect->h);
|
||||
break;
|
||||
}
|
||||
case VIDEO_BACKGROUND_NONE:
|
||||
SDL_SetTextureBlendMode(is->vid_texture, SDL_BLENDMODE_NONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void video_image_display(VideoState *is)
|
||||
{
|
||||
Frame *vp;
|
||||
Frame *sp = NULL;
|
||||
SDL_Rect *rect = &is->render_params.target_rect;
|
||||
SDL_Rect rect;
|
||||
|
||||
vp = frame_queue_peek_last(&is->pictq);
|
||||
calculate_display_rect(rect, is->xleft, is->ytop, is->width, is->height, vp->width, vp->height, vp->sar);
|
||||
if (vk_renderer) {
|
||||
vk_renderer_display(vk_renderer, vp->frame, &is->render_params);
|
||||
vk_renderer_display(vk_renderer, vp->frame);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1060,6 +1015,7 @@ static void video_image_display(VideoState *is)
|
||||
}
|
||||
}
|
||||
|
||||
calculate_display_rect(&rect, is->xleft, is->ytop, is->width, is->height, vp->width, vp->height, vp->sar);
|
||||
set_sdl_yuv_conversion_mode(vp->frame);
|
||||
|
||||
if (!vp->uploaded) {
|
||||
@@ -1071,16 +1027,15 @@ static void video_image_display(VideoState *is)
|
||||
vp->flip_v = vp->frame->linesize[0] < 0;
|
||||
}
|
||||
|
||||
draw_video_background(is);
|
||||
SDL_RenderCopyEx(renderer, is->vid_texture, NULL, rect, 0, NULL, vp->flip_v ? SDL_FLIP_VERTICAL : 0);
|
||||
SDL_RenderCopyEx(renderer, is->vid_texture, NULL, &rect, 0, NULL, vp->flip_v ? SDL_FLIP_VERTICAL : 0);
|
||||
set_sdl_yuv_conversion_mode(NULL);
|
||||
if (sp) {
|
||||
#if USE_ONEPASS_SUBTITLE_RENDER
|
||||
SDL_RenderCopy(renderer, is->sub_texture, NULL, rect);
|
||||
SDL_RenderCopy(renderer, is->sub_texture, NULL, &rect);
|
||||
#else
|
||||
int i;
|
||||
double xratio = (double)rect->w / (double)sp->width;
|
||||
double yratio = (double)rect->h / (double)sp->height;
|
||||
double xratio = (double)rect.w / (double)sp->width;
|
||||
double yratio = (double)rect.h / (double)sp->height;
|
||||
for (i = 0; i < sp->sub.num_rects; i++) {
|
||||
SDL_Rect *sub_rect = (SDL_Rect*)sp->sub.rects[i];
|
||||
SDL_Rect target = {.x = rect.x + sub_rect->x * xratio,
|
||||
@@ -1951,7 +1906,6 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
||||
par->sample_aspect_ratio = codecpar->sample_aspect_ratio;
|
||||
par->color_space = frame->colorspace;
|
||||
par->color_range = frame->color_range;
|
||||
par->alpha_mode = frame->alpha_mode;
|
||||
par->frame_rate = fr;
|
||||
par->hw_frames_ctx = frame->hw_frames_ctx;
|
||||
ret = av_buffersrc_parameters_set(filt_src, par);
|
||||
@@ -1978,11 +1932,6 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
||||
AV_OPT_TYPE_INT, sdl_supported_color_spaces)) < 0)
|
||||
goto fail;
|
||||
|
||||
if ((ret = av_opt_set_array(filt_out, "alphamodes", AV_OPT_SEARCH_CHILDREN,
|
||||
0, FF_ARRAY_ELEMS(sdl_supported_alpha_modes),
|
||||
AV_OPT_TYPE_INT, sdl_supported_alpha_modes)) < 0)
|
||||
goto fail;
|
||||
|
||||
ret = avfilter_init_dict(filt_out, NULL);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
@@ -2883,7 +2832,6 @@ static int read_thread(void *arg)
|
||||
int st_index[AVMEDIA_TYPE_NB];
|
||||
AVPacket *pkt = NULL;
|
||||
int64_t stream_start_time;
|
||||
char metadata_description[96];
|
||||
int pkt_in_play_range = 0;
|
||||
const AVDictionaryEntry *t;
|
||||
SDL_mutex *wait_mutex = SDL_CreateMutex();
|
||||
@@ -2991,10 +2939,8 @@ static int read_thread(void *arg)
|
||||
|
||||
is->realtime = is_realtime(ic);
|
||||
|
||||
if (show_status) {
|
||||
fprintf(stderr, "\x1b[2K\r");
|
||||
if (show_status)
|
||||
av_dump_format(ic, 0, is->filename, 0);
|
||||
}
|
||||
|
||||
for (i = 0; i < ic->nb_streams; i++) {
|
||||
AVStream *st = ic->streams[i];
|
||||
@@ -3003,9 +2949,6 @@ static int read_thread(void *arg)
|
||||
if (type >= 0 && wanted_stream_spec[type] && st_index[type] == -1)
|
||||
if (avformat_match_stream_specifier(ic, st, wanted_stream_spec[type]) > 0)
|
||||
st_index[type] = i;
|
||||
// Clear all pre-existing metadata update flags to avoid printing
|
||||
// initial metadata as update.
|
||||
st->event_flags &= ~AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
|
||||
}
|
||||
for (i = 0; i < AVMEDIA_TYPE_NB; i++) {
|
||||
if (wanted_stream_spec[i] && st_index[i] == -1) {
|
||||
@@ -3174,19 +3117,6 @@ static int read_thread(void *arg)
|
||||
} else {
|
||||
is->eof = 0;
|
||||
}
|
||||
|
||||
if (show_status && ic->streams[pkt->stream_index]->event_flags &
|
||||
AVSTREAM_EVENT_FLAG_METADATA_UPDATED) {
|
||||
fprintf(stderr, "\x1b[2K\r");
|
||||
snprintf(metadata_description,
|
||||
sizeof(metadata_description),
|
||||
"\r New metadata for stream %d",
|
||||
pkt->stream_index);
|
||||
dump_dictionary(NULL, ic->streams[pkt->stream_index]->metadata,
|
||||
metadata_description, " ", AV_LOG_INFO);
|
||||
}
|
||||
ic->streams[pkt->stream_index]->event_flags &= ~AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
|
||||
|
||||
/* check if packet is in play range specified by user, then queue, otherwise discard */
|
||||
stream_start_time = ic->streams[pkt->stream_index]->start_time;
|
||||
pkt_ts = pkt->pts == AV_NOPTS_VALUE ? pkt->dts : pkt->pts;
|
||||
@@ -3268,16 +3198,6 @@ static VideoState *stream_open(const char *filename,
|
||||
av_log(NULL, AV_LOG_WARNING, "-volume=%d < 0, setting to 0\n", startup_volume);
|
||||
if (startup_volume > 100)
|
||||
av_log(NULL, AV_LOG_WARNING, "-volume=%d > 100, setting to 100\n", startup_volume);
|
||||
if (video_background) {
|
||||
if (!strcmp(video_background, "none")) {
|
||||
is->render_params.video_background_type = VIDEO_BACKGROUND_NONE;
|
||||
} else if (strcmp(video_background, "tiles")) {
|
||||
if (av_parse_color(is->render_params.video_background_color, video_background, -1, NULL) >= 0)
|
||||
is->render_params.video_background_type = VIDEO_BACKGROUND_COLOR;
|
||||
else
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
startup_volume = av_clip(startup_volume, 0, 100);
|
||||
startup_volume = av_clip(SDL_MIX_MAXVOLUME * startup_volume / 100, 0, SDL_MIX_MAXVOLUME);
|
||||
is->audio_volume = startup_volume;
|
||||
@@ -3791,7 +3711,6 @@ static const OptionDef options[] = {
|
||||
{ "filter_threads", OPT_TYPE_INT, OPT_EXPERT, { &filter_nbthreads }, "number of filter threads per graph" },
|
||||
{ "enable_vulkan", OPT_TYPE_BOOL, 0, { &enable_vulkan }, "enable vulkan renderer" },
|
||||
{ "vulkan_params", OPT_TYPE_STRING, OPT_EXPERT, { &vulkan_params }, "vulkan configuration using a list of key=value pairs separated by ':'" },
|
||||
{ "video_bg", OPT_TYPE_STRING, OPT_EXPERT, { &video_background }, "set video background for transparent videos" },
|
||||
{ "hwaccel", OPT_TYPE_STRING, OPT_EXPERT, { &hwaccel }, "use HW accelerated decoding" },
|
||||
{ NULL, },
|
||||
};
|
||||
@@ -3826,9 +3745,9 @@ void show_help_default(const char *opt, const char *arg)
|
||||
"c cycle program\n"
|
||||
"w cycle video filters or show modes\n"
|
||||
"s activate frame-step mode\n"
|
||||
"left/right seek backward/forward by 10 seconds or a custom interval if -seek_interval is set\n"
|
||||
"left/right seek backward/forward 10 seconds or to custom interval if -seek_interval is set\n"
|
||||
"down/up seek backward/forward 1 minute\n"
|
||||
"page down/page up seek to previous/next chapter or backward/forward 10 minutes if no chapters\n"
|
||||
"page down/page up seek backward/forward 10 minutes\n"
|
||||
"right mouse click seek to percentage in file corresponding to fraction of width\n"
|
||||
"left double-click toggle full screen\n"
|
||||
);
|
||||
|
||||
+38
-35
@@ -53,7 +53,7 @@ struct VkRenderer {
|
||||
|
||||
int (*get_hw_dev)(VkRenderer *renderer, AVBufferRef **dev);
|
||||
|
||||
int (*display)(VkRenderer *renderer, AVFrame *frame, RenderParams *params);
|
||||
int (*display)(VkRenderer *renderer, AVFrame *frame);
|
||||
|
||||
int (*resize)(VkRenderer *renderer, int width, int height);
|
||||
|
||||
@@ -104,6 +104,36 @@ static void vk_log_cb(void *log_priv, enum pl_log_level level,
|
||||
av_log(log_priv, level_map[level], "%s\n", msg);
|
||||
}
|
||||
|
||||
// Should keep sync with optional_device_exts inside hwcontext_vulkan.c
|
||||
static const char *optional_device_exts[] = {
|
||||
/* Misc or required by other extensions */
|
||||
VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME,
|
||||
VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME,
|
||||
VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME,
|
||||
VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME,
|
||||
VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME,
|
||||
VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME,
|
||||
VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME,
|
||||
|
||||
/* Imports/exports */
|
||||
VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME,
|
||||
VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME,
|
||||
VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME,
|
||||
VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME,
|
||||
VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME,
|
||||
#ifdef _WIN32
|
||||
VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME,
|
||||
VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME,
|
||||
#endif
|
||||
|
||||
/* Video encoding/decoding */
|
||||
VK_KHR_VIDEO_QUEUE_EXTENSION_NAME,
|
||||
VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME,
|
||||
VK_KHR_VIDEO_DECODE_H264_EXTENSION_NAME,
|
||||
VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME,
|
||||
"VK_MESA_video_decode_av1",
|
||||
};
|
||||
|
||||
static inline int enable_debug(const AVDictionary *opt)
|
||||
{
|
||||
AVDictionaryEntry *entry = av_dict_get(opt, "debug", NULL, 0);
|
||||
@@ -344,8 +374,6 @@ static int create_vk_by_placebo(VkRenderer *renderer,
|
||||
int decode_index;
|
||||
int decode_count;
|
||||
int ret;
|
||||
const char **dev_exts;
|
||||
int num_dev_exts;
|
||||
|
||||
ctx->get_proc_addr = SDL_Vulkan_GetVkGetInstanceProcAddr();
|
||||
|
||||
@@ -360,21 +388,16 @@ static int create_vk_by_placebo(VkRenderer *renderer,
|
||||
}
|
||||
ctx->inst = ctx->placebo_instance->instance;
|
||||
|
||||
dev_exts = av_vk_get_optional_device_extensions(&num_dev_exts);
|
||||
if (!dev_exts)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ctx->placebo_vulkan = pl_vulkan_create(ctx->vk_log, pl_vulkan_params(
|
||||
.instance = ctx->placebo_instance->instance,
|
||||
.get_proc_addr = ctx->placebo_instance->get_proc_addr,
|
||||
.surface = ctx->vk_surface,
|
||||
.allow_software = false,
|
||||
.opt_extensions = dev_exts,
|
||||
.num_opt_extensions = num_dev_exts,
|
||||
.opt_extensions = optional_device_exts,
|
||||
.num_opt_extensions = FF_ARRAY_ELEMS(optional_device_exts),
|
||||
.extra_queues = VK_QUEUE_VIDEO_DECODE_BIT_KHR,
|
||||
.device_name = select_device(opt),
|
||||
));
|
||||
av_free(dev_exts);
|
||||
if (!ctx->placebo_vulkan)
|
||||
return AVERROR_EXTERNAL;
|
||||
ctx->hw_device_ref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VULKAN);
|
||||
@@ -702,13 +725,11 @@ static int convert_frame(VkRenderer *renderer, AVFrame *frame)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int display(VkRenderer *renderer, AVFrame *frame, RenderParams *params)
|
||||
static int display(VkRenderer *renderer, AVFrame *frame)
|
||||
{
|
||||
SDL_Rect *rect = ¶ms->target_rect;
|
||||
struct pl_swapchain_frame swap_frame = {0};
|
||||
struct pl_frame pl_frame = {0};
|
||||
struct pl_frame target = {0};
|
||||
struct pl_render_params pl_params = pl_render_default_params;
|
||||
RendererContext *ctx = (RendererContext *) renderer;
|
||||
int ret = 0;
|
||||
struct pl_color_space hint = {0};
|
||||
@@ -733,26 +754,8 @@ static int display(VkRenderer *renderer, AVFrame *frame, RenderParams *params)
|
||||
}
|
||||
|
||||
pl_frame_from_swapchain(&target, &swap_frame);
|
||||
|
||||
target.crop = (pl_rect2df){.x0 = rect->x, .x1 = rect->x + rect->w,
|
||||
.y0 = rect->y, .y1 = rect->y + rect->h};
|
||||
switch (params->video_background_type) {
|
||||
case VIDEO_BACKGROUND_TILES:
|
||||
pl_params.background = PL_CLEAR_TILES;
|
||||
pl_params.tile_size = VIDEO_BACKGROUND_TILE_SIZE * 2;
|
||||
break;
|
||||
case VIDEO_BACKGROUND_COLOR:
|
||||
pl_params.background = PL_CLEAR_COLOR;
|
||||
for (int i = 0; i < 3; i++)
|
||||
pl_params.background_color[i] = params->video_background_color[i] / 255.0;
|
||||
pl_params.background_transparency = (255 - params->video_background_color[3]) / 255.0;
|
||||
break;
|
||||
case VIDEO_BACKGROUND_NONE:
|
||||
pl_frame.repr.alpha = PL_ALPHA_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!pl_render_image(ctx->renderer, &pl_frame, &target, &pl_params)) {
|
||||
if (!pl_render_image(ctx->renderer, &pl_frame, &target,
|
||||
&pl_render_default_params)) {
|
||||
av_log(NULL, AV_LOG_ERROR, "pl_render_image failed\n");
|
||||
ret = AVERROR_EXTERNAL;
|
||||
goto out;
|
||||
@@ -855,9 +858,9 @@ int vk_renderer_get_hw_dev(VkRenderer *renderer, AVBufferRef **dev)
|
||||
return renderer->get_hw_dev(renderer, dev);
|
||||
}
|
||||
|
||||
int vk_renderer_display(VkRenderer *renderer, AVFrame *frame, RenderParams *render_params)
|
||||
int vk_renderer_display(VkRenderer *renderer, AVFrame *frame)
|
||||
{
|
||||
return renderer->display(renderer, frame, render_params);
|
||||
return renderer->display(renderer, frame);
|
||||
}
|
||||
|
||||
int vk_renderer_resize(VkRenderer *renderer, int width, int height)
|
||||
|
||||
@@ -25,20 +25,6 @@
|
||||
|
||||
typedef struct VkRenderer VkRenderer;
|
||||
|
||||
#define VIDEO_BACKGROUND_TILE_SIZE 64
|
||||
|
||||
enum VideoBackgroundType {
|
||||
VIDEO_BACKGROUND_TILES,
|
||||
VIDEO_BACKGROUND_COLOR,
|
||||
VIDEO_BACKGROUND_NONE,
|
||||
};
|
||||
|
||||
typedef struct RenderParams {
|
||||
SDL_Rect target_rect;
|
||||
uint8_t video_background_color[4];
|
||||
enum VideoBackgroundType video_background_type;
|
||||
} RenderParams;
|
||||
|
||||
VkRenderer *vk_get_renderer(void);
|
||||
|
||||
int vk_renderer_create(VkRenderer *renderer, SDL_Window *window,
|
||||
@@ -46,7 +32,7 @@ int vk_renderer_create(VkRenderer *renderer, SDL_Window *window,
|
||||
|
||||
int vk_renderer_get_hw_dev(VkRenderer *renderer, AVBufferRef **dev);
|
||||
|
||||
int vk_renderer_display(VkRenderer *renderer, AVFrame *frame, RenderParams *params);
|
||||
int vk_renderer_display(VkRenderer *renderer, AVFrame *frame);
|
||||
|
||||
int vk_renderer_resize(VkRenderer *renderer, int width, int height);
|
||||
|
||||
|
||||
+24
-211
@@ -36,7 +36,6 @@
|
||||
#include "libavutil/ambient_viewing_environment.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/display.h"
|
||||
@@ -131,11 +130,6 @@ static int use_byte_value_binary_prefix = 0;
|
||||
static int use_value_sexagesimal_format = 0;
|
||||
static int show_private_data = 1;
|
||||
|
||||
static const char *audio_codec_name = NULL;
|
||||
static const char *data_codec_name = NULL;
|
||||
static const char *subtitle_codec_name = NULL;
|
||||
static const char *video_codec_name = NULL;
|
||||
|
||||
#define SHOW_OPTIONAL_FIELDS_AUTO -1
|
||||
#define SHOW_OPTIONAL_FIELDS_NEVER 0
|
||||
#define SHOW_OPTIONAL_FIELDS_ALWAYS 1
|
||||
@@ -144,7 +138,6 @@ static int show_optional_fields = SHOW_OPTIONAL_FIELDS_AUTO;
|
||||
static char *output_format;
|
||||
static char *stream_specifier;
|
||||
static char *show_data_hash;
|
||||
static char *data_dump_format;
|
||||
|
||||
typedef struct ReadInterval {
|
||||
int id; ///< identifier
|
||||
@@ -253,7 +246,7 @@ static const char *get_stream_group_type(const void *data)
|
||||
return av_x_if_null(avformat_stream_group_name(stg->type), "unknown");
|
||||
}
|
||||
|
||||
static const AVTextFormatSection sections[] = {
|
||||
static struct AVTextFormatSection sections[] = {
|
||||
[SECTION_ID_CHAPTERS] = { SECTION_ID_CHAPTERS, "chapters", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_CHAPTER, -1 } },
|
||||
[SECTION_ID_CHAPTER] = { SECTION_ID_CHAPTER, "chapter", 0, { SECTION_ID_CHAPTER_TAGS, -1 } },
|
||||
[SECTION_ID_CHAPTER_TAGS] = { SECTION_ID_CHAPTER_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "chapter_tags" },
|
||||
@@ -325,13 +318,6 @@ static const AVTextFormatSection sections[] = {
|
||||
[SECTION_ID_SUBTITLE] = { SECTION_ID_SUBTITLE, "subtitle", 0, { -1 } },
|
||||
};
|
||||
|
||||
typedef struct EntrySelection {
|
||||
int show_all_entries;
|
||||
AVDictionary *entries_to_show;
|
||||
} EntrySelection;
|
||||
|
||||
static EntrySelection selected_entries[FF_ARRAY_ELEMS(sections)] = { 0 };
|
||||
|
||||
static const OptionDef *options;
|
||||
|
||||
/* FFprobe context */
|
||||
@@ -366,14 +352,6 @@ typedef struct LogBuffer {
|
||||
static LogBuffer *log_buffer;
|
||||
static int log_buffer_size;
|
||||
|
||||
static int is_key_selected_callback(AVTextFormatContext *tctx, const char *key)
|
||||
{
|
||||
const AVTextFormatSection *section = tctx->section[tctx->level];
|
||||
const EntrySelection *selection = &selected_entries[section - sections];
|
||||
|
||||
return selection->show_all_entries || av_dict_get(selection->entries_to_show, key, NULL, 0);
|
||||
}
|
||||
|
||||
static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
|
||||
{
|
||||
AVClass* avc = ptr ? *(AVClass **) ptr : NULL;
|
||||
@@ -453,30 +431,6 @@ static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
|
||||
#define print_duration_ts(k, v) avtext_print_ts(tfc, k, v, 1)
|
||||
#define print_val(k, v, u) avtext_print_unit_integer(tfc, k, v, u)
|
||||
|
||||
static void print_integers(AVTextFormatContext *tfc, const char *key,
|
||||
const void *data, int size, const char *format,
|
||||
int columns, int bytes, int offset_add)
|
||||
{
|
||||
AVBPrint bp;
|
||||
unsigned offset = 0;
|
||||
|
||||
av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);
|
||||
av_bprint_chars(&bp, '\n', 1);
|
||||
while (size) {
|
||||
av_bprintf(&bp, "%08x: ", offset);
|
||||
for (int i = 0, l = FFMIN(size, columns); i < l; i++) {
|
||||
if (bytes == 1) av_bprintf(&bp, format, *(const uint8_t*)data);
|
||||
else if (bytes == 2) av_bprintf(&bp, format, AV_RN16(data));
|
||||
else if (bytes == 4) av_bprintf(&bp, format, AV_RN32(data));
|
||||
data = (const char*)data + bytes;
|
||||
size--;
|
||||
}
|
||||
av_bprint_chars(&bp, '\n', 1);
|
||||
offset += offset_add;
|
||||
}
|
||||
avtext_print_string(tfc, key, bp.str, 0);
|
||||
}
|
||||
|
||||
#define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n) \
|
||||
{ \
|
||||
ret = av_reallocp_array(&(ptr), (new_n), sizeof(*(ptr))); \
|
||||
@@ -508,7 +462,7 @@ static void print_displaymatrix(AVTextFormatContext *tfc, const int32_t matrix[9
|
||||
double rotation = av_display_rotation_get(matrix);
|
||||
if (isnan(rotation))
|
||||
rotation = 0;
|
||||
print_integers(tfc, "displaymatrix", matrix, 9, " %11d", 3, 4, 1);
|
||||
avtext_print_integers(tfc, "displaymatrix", (void*)matrix, 9, " %11d", 3, 4, 1);
|
||||
print_int("rotation", rotation);
|
||||
}
|
||||
|
||||
@@ -1103,12 +1057,6 @@ static void print_pkt_side_data(AVTextFormatContext *tfc,
|
||||
print_int("crop_right", AV_RL32(sd->data + 12));
|
||||
} else if (sd->type == AV_PKT_DATA_AFD && sd->size > 0) {
|
||||
print_int("active_format", *sd->data);
|
||||
} else if (sd->type == AV_PKT_DATA_EXIF) {
|
||||
print_int("size", sd->size);
|
||||
} else if (sd->type == AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL && sd->size >= 8) {
|
||||
print_int("block_additional_id", AV_RB64(sd->data));
|
||||
if (do_show_data)
|
||||
avtext_print_data(tfc, "block_additional_data", sd->data + 8, sd->size - 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1200,16 +1148,6 @@ static void print_chroma_location(AVTextFormatContext *tfc, enum AVChromaLocatio
|
||||
}
|
||||
}
|
||||
|
||||
static void print_alpha_mode(AVTextFormatContext *tfc, enum AVAlphaMode alpha_mode)
|
||||
{
|
||||
const char *val = av_alpha_mode_name(alpha_mode);
|
||||
if (!val || alpha_mode == AVALPHA_MODE_UNSPECIFIED) {
|
||||
print_str_opt("alpha_mode", "unspecified");
|
||||
} else {
|
||||
print_str("alpha_mode", val);
|
||||
}
|
||||
}
|
||||
|
||||
static void clear_log(int need_lock)
|
||||
{
|
||||
int i;
|
||||
@@ -1398,8 +1336,6 @@ static void print_frame_side_data(AVTextFormatContext *tfc,
|
||||
print_film_grain_params(tfc, fgp);
|
||||
} else if (sd->type == AV_FRAME_DATA_VIEW_ID) {
|
||||
print_int("view_id", *(int*)sd->data);
|
||||
} else if (sd->type == AV_FRAME_DATA_EXIF) {
|
||||
print_int("size", sd->size);
|
||||
}
|
||||
avtext_print_section_footer(tfc);
|
||||
}
|
||||
@@ -1464,7 +1400,6 @@ static void show_frame(AVTextFormatContext *tfc, AVFrame *frame, AVStream *strea
|
||||
print_primaries(tfc, frame->color_primaries);
|
||||
print_color_trc(tfc, frame->color_trc);
|
||||
print_chroma_location(tfc, frame->chroma_location);
|
||||
print_alpha_mode(tfc, frame->alpha_mode);
|
||||
break;
|
||||
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
@@ -1820,10 +1755,6 @@ static int show_stream(AVTextFormatContext *tfc, AVFormatContext *fmt_ctx, int s
|
||||
print_str("codec_tag_string", av_fourcc2str(par->codec_tag));
|
||||
print_fmt("codec_tag", "0x%04"PRIx32, par->codec_tag);
|
||||
|
||||
av_bprint_clear(&pbuf);
|
||||
if (!av_mime_codec_str(par, stream->avg_frame_rate, &pbuf))
|
||||
print_str("mime_codec_string", pbuf.str);
|
||||
|
||||
switch (par->codec_type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
print_int("width", par->width);
|
||||
@@ -1872,7 +1803,7 @@ static int show_stream(AVTextFormatContext *tfc, AVFormatContext *fmt_ctx, int s
|
||||
else
|
||||
print_str_opt("field_order", "unknown");
|
||||
|
||||
if (dec_ctx && do_read_frames)
|
||||
if (dec_ctx)
|
||||
print_int("refs", dec_ctx->refs);
|
||||
break;
|
||||
|
||||
@@ -2122,10 +2053,6 @@ static void print_iamf_param_definition(AVTextFormatContext *tfc, const char *na
|
||||
static void print_iamf_audio_element_params(AVTextFormatContext *tfc, const AVStreamGroup *stg,
|
||||
const AVIAMFAudioElement *audio_element)
|
||||
{
|
||||
AVBPrint pbuf;
|
||||
|
||||
av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
|
||||
avtext_print_section_header(tfc, stg, SECTION_ID_STREAM_GROUP_COMPONENT);
|
||||
print_int("nb_layers", audio_element->nb_layers);
|
||||
print_int("audio_element_type", audio_element->audio_element_type);
|
||||
@@ -2140,12 +2067,8 @@ static void print_iamf_audio_element_params(AVTextFormatContext *tfc, const AVSt
|
||||
if (audio_element->audio_element_type == AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL) {
|
||||
print_int("output_gain_flags", layer->output_gain_flags);
|
||||
print_q("output_gain", layer->output_gain, '/');
|
||||
} else if (audio_element->audio_element_type == AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE) {
|
||||
} else if (audio_element->audio_element_type == AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE)
|
||||
print_int("ambisonics_mode", layer->ambisonics_mode);
|
||||
if (layer->ambisonics_mode == AV_IAMF_AMBISONICS_MODE_PROJECTION)
|
||||
print_list_fmt("demixing_matrix", "%d/%d", layer->nb_demixing_matrix, 1, layer->demixing_matrix[idx].num,
|
||||
layer->demixing_matrix[idx].den);
|
||||
}
|
||||
avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENT
|
||||
}
|
||||
if (audio_element->demixing_info)
|
||||
@@ -2156,8 +2079,6 @@ static void print_iamf_audio_element_params(AVTextFormatContext *tfc, const AVSt
|
||||
SECTION_ID_STREAM_GROUP_SUBCOMPONENT);
|
||||
avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENTS
|
||||
avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_COMPONENT
|
||||
|
||||
av_bprint_finalize(&pbuf, NULL);
|
||||
}
|
||||
|
||||
static void print_iamf_submix_params(AVTextFormatContext *tfc, const AVIAMFSubmix *submix)
|
||||
@@ -2363,65 +2284,6 @@ static void show_error(AVTextFormatContext *tfc, int err)
|
||||
avtext_print_section_footer(tfc);
|
||||
}
|
||||
|
||||
static int get_decoder_by_name(const char *codec_name, const AVCodec **codec)
|
||||
{
|
||||
if (codec_name == NULL)
|
||||
return 0;
|
||||
|
||||
*codec = avcodec_find_decoder_by_name(codec_name);
|
||||
if (*codec == NULL) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"No codec could be found with name '%s'\n", codec_name);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_decoders(AVFormatContext *fmt_ctx)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#define GET_DECODER(type_) \
|
||||
ret = get_decoder_by_name(type_##_codec_name, &fmt_ctx->type_##_codec); \
|
||||
if (ret < 0) return ret;
|
||||
|
||||
GET_DECODER(audio);
|
||||
GET_DECODER(data);
|
||||
GET_DECODER(subtitle);
|
||||
GET_DECODER(video);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const AVCodec *get_decoder_for_stream(AVFormatContext *fmt_ctx, AVStream *stream)
|
||||
{
|
||||
const AVCodec *codec = NULL;
|
||||
switch (stream->codecpar->codec_type) {
|
||||
case AVMEDIA_TYPE_VIDEO: codec = fmt_ctx->video_codec; break;
|
||||
case AVMEDIA_TYPE_AUDIO: codec = fmt_ctx->audio_codec; break;
|
||||
case AVMEDIA_TYPE_SUBTITLE: codec = fmt_ctx->subtitle_codec; break;
|
||||
case AVMEDIA_TYPE_DATA: codec = fmt_ctx->data_codec; break;
|
||||
}
|
||||
|
||||
if (codec != NULL)
|
||||
return codec;
|
||||
|
||||
if (stream->codecpar->codec_id == AV_CODEC_ID_PROBE) {
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"Failed to probe codec for input stream %d\n", stream->index);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
codec = avcodec_find_decoder(stream->codecpar->codec_id);
|
||||
if (codec == NULL) {
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"Unsupported codec with id %d for input stream %d\n",
|
||||
stream->codecpar->codec_id, stream->index);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return codec;
|
||||
}
|
||||
|
||||
static int open_input_file(InputFile *ifile, const char *filename,
|
||||
const char *print_filename)
|
||||
{
|
||||
@@ -2434,9 +2296,6 @@ static int open_input_file(InputFile *ifile, const char *filename,
|
||||
if (!fmt_ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
err = set_decoders(fmt_ctx);
|
||||
if (err < 0)
|
||||
return err;
|
||||
if (!av_dict_get(format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE)) {
|
||||
av_dict_set(&format_opts, "scan_all_pmts", "1", AV_DICT_DONT_OVERWRITE);
|
||||
scan_all_pmts_set = 1;
|
||||
@@ -2491,10 +2350,20 @@ static int open_input_file(InputFile *ifile, const char *filename,
|
||||
|
||||
ist->st = stream;
|
||||
|
||||
codec = get_decoder_for_stream(fmt_ctx, stream);
|
||||
if (!codec)
|
||||
if (stream->codecpar->codec_id == AV_CODEC_ID_PROBE) {
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"Failed to probe codec for input stream %d\n",
|
||||
stream->index);
|
||||
continue;
|
||||
}
|
||||
|
||||
codec = avcodec_find_decoder(stream->codecpar->codec_id);
|
||||
if (!codec) {
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"Unsupported codec with id %d for input stream %d\n",
|
||||
stream->codecpar->codec_id, stream->index);
|
||||
continue;
|
||||
}
|
||||
{
|
||||
AVDictionary *opts;
|
||||
|
||||
@@ -2641,10 +2510,6 @@ end:
|
||||
av_freep(&selected_streams);
|
||||
av_freep(&streams_with_closed_captions);
|
||||
av_freep(&streams_with_film_grain);
|
||||
av_freep(&audio_codec_name);
|
||||
av_freep(&data_codec_name);
|
||||
av_freep(&subtitle_codec_name);
|
||||
av_freep(&video_codec_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -2781,15 +2646,14 @@ static int opt_format(void *optctx, const char *opt, const char *arg)
|
||||
static inline void mark_section_show_entries(SectionID section_id,
|
||||
int show_all_entries, AVDictionary *entries)
|
||||
{
|
||||
EntrySelection *selection = &selected_entries[section_id];
|
||||
struct AVTextFormatSection *section = §ions[section_id];
|
||||
|
||||
selection->show_all_entries = show_all_entries;
|
||||
section->show_all_entries = show_all_entries;
|
||||
if (show_all_entries) {
|
||||
const AVTextFormatSection *section = §ions[section_id];
|
||||
for (const int *id = section->children_ids; *id != -1; id++)
|
||||
mark_section_show_entries(*id, show_all_entries, entries);
|
||||
} else {
|
||||
av_dict_copy(&selection->entries_to_show, entries, 0);
|
||||
av_dict_copy(§ion->entries_to_show, entries, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3100,36 +2964,6 @@ static int opt_sections(void *optctx, const char *opt, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_codec(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
const char *spec = strchr(opt, ':');
|
||||
const char **name;
|
||||
if (!spec) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"No media specifier was specified for '%s' in option '%s'. Use -%s:<media_spec> "
|
||||
"where <media_spec> can be one of: 'a' (audio), 'v' (video), 's' (subtitle), 'd' (data)\n",
|
||||
arg, opt, opt);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
spec++;
|
||||
|
||||
switch (spec[0]) {
|
||||
case 'a' : name = &audio_codec_name; break;
|
||||
case 'd' : name = &data_codec_name; break;
|
||||
case 's' : name = &subtitle_codec_name; break;
|
||||
case 'v' : name = &video_codec_name; break;
|
||||
default:
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Invalid media specifier '%s' in option '%s'. "
|
||||
"Must be one of: 'a' (audio), 'v' (video), 's' (subtitle), 'd' (data)\n", spec, opt);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
av_freep(name);
|
||||
*name = av_strdup(arg);
|
||||
return *name ? 0 : AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
static int opt_show_versions(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
mark_section_show_entries(SECTION_ID_PROGRAM_VERSION, 1, NULL);
|
||||
@@ -3173,7 +3007,6 @@ static const OptionDef real_options[] = {
|
||||
{ "of", OPT_TYPE_STRING, 0, { &output_format }, "alias for -output_format", "format" },
|
||||
{ "select_streams", OPT_TYPE_STRING, 0, { &stream_specifier }, "select the specified streams", "stream_specifier" },
|
||||
{ "sections", OPT_TYPE_FUNC, OPT_EXIT, {.func_arg = opt_sections}, "print sections structure and section information, and exit" },
|
||||
{ "data_dump_format", OPT_TYPE_STRING, 0, { &data_dump_format }, "set data dump format (available formats are: xxd, base64)" },
|
||||
{ "show_data", OPT_TYPE_BOOL, 0, { &do_show_data }, "show packets data" },
|
||||
{ "show_data_hash", OPT_TYPE_STRING, 0, { &show_data_hash }, "show packets data hash" },
|
||||
{ "show_error", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_error }, "show probing error" },
|
||||
@@ -3206,19 +3039,14 @@ static const OptionDef real_options[] = {
|
||||
{ "print_filename", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"},
|
||||
{ "find_stream_info", OPT_TYPE_BOOL, OPT_INPUT | OPT_EXPERT, { &find_stream_info },
|
||||
"read and decode the streams to fill missing information with heuristics" },
|
||||
{ "c", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
|
||||
{ "codec", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_codec}, "alias for -c (force decoder)", "decoder_name" },
|
||||
{ NULL, },
|
||||
};
|
||||
|
||||
static inline int check_section_show_entries(int section_id)
|
||||
{
|
||||
const EntrySelection *selection = &selected_entries[section_id];
|
||||
|
||||
if (selection->show_all_entries || selection->entries_to_show)
|
||||
struct AVTextFormatSection *section = §ions[section_id];
|
||||
if (sections[section_id].show_all_entries || sections[section_id].entries_to_show)
|
||||
return 1;
|
||||
|
||||
const AVTextFormatSection *section = §ions[section_id];
|
||||
for (const int *id = section->children_ids; *id != -1; id++)
|
||||
if (check_section_show_entries(*id))
|
||||
return 1;
|
||||
@@ -3237,8 +3065,7 @@ int main(int argc, char **argv)
|
||||
AVTextWriterContext *wctx;
|
||||
char *buf;
|
||||
char *f_name = NULL, *f_args = NULL;
|
||||
int ret, input_ret;
|
||||
AVTextFormatDataDump data_dump_format_id;
|
||||
int ret, input_ret, i;
|
||||
|
||||
init_dynload();
|
||||
|
||||
@@ -3323,18 +3150,6 @@ int main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (data_dump_format) {
|
||||
if (!strcmp(data_dump_format, "xxd")) {
|
||||
data_dump_format_id = AV_TEXTFORMAT_DATADUMP_XXD;
|
||||
} else if (!strcmp(data_dump_format, "base64")) {
|
||||
data_dump_format_id = AV_TEXTFORMAT_DATADUMP_BASE64;
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_ERROR, "Unknown data dump format with name '%s'\n", data_dump_format);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (output_filename) {
|
||||
ret = avtextwriter_create_file(&wctx, output_filename);
|
||||
} else
|
||||
@@ -3344,13 +3159,11 @@ int main(int argc, char **argv)
|
||||
goto end;
|
||||
|
||||
AVTextFormatOptions tf_options = {
|
||||
.is_key_selected = is_key_selected_callback,
|
||||
.show_optional_fields = show_optional_fields,
|
||||
.show_value_unit = show_value_unit,
|
||||
.use_value_prefix = use_value_prefix,
|
||||
.use_byte_value_binary_prefix = use_byte_value_binary_prefix,
|
||||
.use_value_sexagesimal_format = use_value_sexagesimal_format,
|
||||
.data_dump_format = data_dump_format_id,
|
||||
};
|
||||
|
||||
if ((ret = avtext_context_open(&tctx, f, wctx, f_args, sections, FF_ARRAY_ELEMS(sections), tf_options, show_data_hash)) >= 0) {
|
||||
@@ -3402,8 +3215,8 @@ end:
|
||||
av_freep(&read_intervals);
|
||||
|
||||
uninit_opts();
|
||||
for (size_t i = 0; i < FF_ARRAY_ELEMS(selected_entries); ++i)
|
||||
av_dict_free(&selected_entries[i].entries_to_show);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(sections); i++)
|
||||
av_dict_free(&(sections[i].entries_to_show));
|
||||
|
||||
avformat_network_deinit();
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ typedef enum {
|
||||
SECTION_ID_ENCODER,
|
||||
} SectionID;
|
||||
|
||||
static const AVTextFormatSection sections[] = {
|
||||
static struct AVTextFormatSection sections[] = {
|
||||
[SECTION_ID_ROOT] = { SECTION_ID_ROOT, "root", AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER, { SECTION_ID_FILTERGRAPHS, SECTION_ID_INPUTFILES, SECTION_ID_OUTPUTFILES, SECTION_ID_DECODERS, SECTION_ID_ENCODERS, SECTION_ID_STREAMLINKS, -1 } },
|
||||
|
||||
[SECTION_ID_FILTERGRAPHS] = { SECTION_ID_FILTERGRAPHS, "graphs", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_FILTERGRAPH, -1 } },
|
||||
@@ -271,7 +271,7 @@ static void print_link(GraphPrintContext *gpc, AVFilterLink *link)
|
||||
}
|
||||
|
||||
if (link->w && link->h) {
|
||||
if (tfc->opts.show_value_unit) {
|
||||
if (tfc->show_value_unit) {
|
||||
print_fmt("size", "%dx%d", link->w, link->h);
|
||||
} else {
|
||||
print_int("width", link->w);
|
||||
@@ -292,7 +292,7 @@ static void print_link(GraphPrintContext *gpc, AVFilterLink *link)
|
||||
////print_str("format", av_x_if_null(av_get_subtitle_fmt_name(link->format), "?"));
|
||||
|
||||
if (link->w && link->h) {
|
||||
if (tfc->opts.show_value_unit) {
|
||||
if (tfc->show_value_unit) {
|
||||
print_fmt("size", "%dx%d", link->w, link->h);
|
||||
} else {
|
||||
print_int("width", link->w);
|
||||
@@ -306,7 +306,7 @@ static void print_link(GraphPrintContext *gpc, AVFilterLink *link)
|
||||
av_channel_layout_describe(&link->ch_layout, layout_string, sizeof(layout_string));
|
||||
print_str("channel_layout", layout_string);
|
||||
print_val("channels", link->ch_layout.nb_channels, "ch");
|
||||
if (tfc->opts.show_value_unit)
|
||||
if (tfc->show_value_unit)
|
||||
print_fmt("sample_rate", "%d.1 kHz", link->sample_rate / 1000);
|
||||
else
|
||||
print_val("sample_rate", link->sample_rate, "Hz");
|
||||
@@ -470,6 +470,12 @@ static void print_filter(GraphPrintContext *gpc, const AVFilterContext *filter,
|
||||
avtext_print_section_footer(tfc); // SECTION_ID_FILTER
|
||||
}
|
||||
|
||||
static void init_sections(void)
|
||||
{
|
||||
for (unsigned i = 0; i < FF_ARRAY_ELEMS(sections); i++)
|
||||
sections[i].show_all_entries = 1;
|
||||
}
|
||||
|
||||
static void print_filtergraph_single(GraphPrintContext *gpc, FilterGraph *fg, AVFilterGraph *graph)
|
||||
{
|
||||
AVTextFormatContext *tfc = gpc->tfc;
|
||||
@@ -870,6 +876,7 @@ static int init_graphprint(GraphPrintContext **pgpc, AVBPrint *target_buf)
|
||||
GraphPrintContext *gpc = NULL;
|
||||
int ret;
|
||||
|
||||
init_sections();
|
||||
*pgpc = NULL;
|
||||
|
||||
av_bprint_init(target_buf, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||
@@ -912,8 +919,8 @@ static int init_graphprint(GraphPrintContext **pgpc, AVBPrint *target_buf)
|
||||
gpc->id_prefix_num = atomic_fetch_add(&prefix_num, 1);
|
||||
gpc->is_diagram = !!(tfc->formatter->flags & AV_TEXTFORMAT_FLAG_IS_DIAGRAM_FORMATTER);
|
||||
if (gpc->is_diagram) {
|
||||
tfc->opts.show_value_unit = 1;
|
||||
tfc->opts.show_optional_fields = -1;
|
||||
tfc->show_value_unit = 1;
|
||||
tfc->show_optional_fields = -1;
|
||||
gpc->opt_flags = AV_TEXTFORMAT_PRINT_STRING_OPTIONAL;
|
||||
gpc->skip_buffer_filters = 1;
|
||||
////} else {
|
||||
@@ -946,13 +953,16 @@ fail:
|
||||
|
||||
int print_filtergraph(FilterGraph *fg, AVFilterGraph *graph)
|
||||
{
|
||||
av_assert2(fg);
|
||||
|
||||
GraphPrintContext *gpc = NULL;
|
||||
AVTextFormatContext *tfc;
|
||||
AVBPrint *target_buf = &fg->graph_print_buf;
|
||||
int ret;
|
||||
|
||||
if (!fg) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Invalid filter graph provided\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (target_buf->len)
|
||||
av_bprint_finalize(target_buf, NULL);
|
||||
|
||||
@@ -960,6 +970,11 @@ int print_filtergraph(FilterGraph *fg, AVFilterGraph *graph)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!gpc) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Failed to initialize graph print context\n");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
tfc = gpc->tfc;
|
||||
|
||||
// Due to the threading model each graph needs to print itself into a buffer
|
||||
@@ -996,6 +1011,11 @@ static int print_filtergraphs_priv(FilterGraph **graphs, int nb_graphs, InputFil
|
||||
if (ret)
|
||||
goto cleanup;
|
||||
|
||||
if (!gpc) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
tfc = gpc->tfc;
|
||||
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_ROOT);
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cmdutils.h"
|
||||
#include "fopen_utf8.h"
|
||||
#include "opt_common.h"
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
@@ -809,8 +808,7 @@ int show_filters(void *optctx, const char *opt, const char *arg)
|
||||
" A = Audio input/output\n"
|
||||
" V = Video input/output\n"
|
||||
" N = Dynamic number and/or type of input/output\n"
|
||||
" | = Source or sink filter\n"
|
||||
" ------\n");
|
||||
" | = Source or sink filter\n");
|
||||
while ((filter = av_filter_iterate(&opaque))) {
|
||||
descr_cur = descr;
|
||||
for (i = 0; i < 2; i++) {
|
||||
@@ -992,7 +990,7 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg)
|
||||
#endif
|
||||
|
||||
while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
|
||||
av_unused enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
|
||||
enum AVPixelFormat av_unused pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
|
||||
printf("%c%c%c%c%c %-16s %d %3d %d",
|
||||
sws_isSupportedInput (pix_fmt) ? 'I' : '.',
|
||||
sws_isSupportedOutput(pix_fmt) ? 'O' : '.',
|
||||
@@ -1206,7 +1204,7 @@ int init_report(const char *env, FILE **file)
|
||||
if (!envlevel)
|
||||
report_file_level = FFMAX(report_file_level, prog_loglevel);
|
||||
|
||||
report_file = fopen_utf8(filename.str, "w");
|
||||
report_file = fopen(filename.str, "w");
|
||||
if (!report_file) {
|
||||
int ret = AVERROR(errno);
|
||||
av_log(NULL, AV_LOG_ERROR, "Failed to open report \"%s\": %s\n",
|
||||
|
||||
@@ -41,9 +41,9 @@ int show_sources(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
#if CONFIG_AVDEVICE
|
||||
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE \
|
||||
{ "sources" , OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_sources }, \
|
||||
{ "sources" , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = show_sources }, \
|
||||
"list sources of the input device", "device" }, \
|
||||
{ "sinks" , OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_sinks }, \
|
||||
{ "sinks" , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = show_sinks }, \
|
||||
"list sinks of the output device", "device" }, \
|
||||
|
||||
#else
|
||||
@@ -198,7 +198,6 @@ int opt_cpucount(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
#define CMDUTILS_COMMON_OPTIONS \
|
||||
{ "L", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_license }, "show license" }, \
|
||||
{ "license", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_license }, "show license" }, \
|
||||
{ "h", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
||||
{ "?", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_help }, "show help", "topic" }, \
|
||||
{ "help", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_help }, "show help", "topic" }, \
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
*.html.c
|
||||
*.css.c
|
||||
*.html.gz
|
||||
*.css.min
|
||||
*.css.min.gz
|
||||
*.css.gz
|
||||
*.min
|
||||
*.min.gz
|
||||
|
||||
@@ -4,16 +4,10 @@ clean::
|
||||
vpath %.html $(SRC_PATH)
|
||||
vpath %.css $(SRC_PATH)
|
||||
|
||||
# Uncomment to prevent deletion during build
|
||||
#.PRECIOUS: %.css.c %.css.min %.css.gz %.css.min.gz %.html.gz %.html.c
|
||||
|
||||
OBJS-resman += \
|
||||
fftools/resources/resman.o \
|
||||
|
||||
|
||||
RESOBJS += \
|
||||
fftools/resources/graph.html.o \
|
||||
fftools/resources/graph.css.o \
|
||||
|
||||
|
||||
$(RESOBJS): CCDEP =
|
||||
$(RESOBJS): CC_DEPFLAGS =
|
||||
|
||||
.SECONDARY: $(RESOBJS:.o=.gz) $(RESOBJS:.o=.c) $(RESOBJS:%.css.o=%.css.min) $(RESOBJS:%.css.o=%.css.min.gz) $(RESOBJS:%.html.o=%.html.gz) $(RESOBJS:.o=)
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/base64.h"
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/error.h"
|
||||
#include "libavutil/hash.h"
|
||||
@@ -148,7 +147,11 @@ int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form
|
||||
goto fail;
|
||||
}
|
||||
|
||||
tctx->opts = options;
|
||||
tctx->show_value_unit = options.show_value_unit;
|
||||
tctx->use_value_prefix = options.use_value_prefix;
|
||||
tctx->use_byte_value_binary_prefix = options.use_byte_value_binary_prefix;
|
||||
tctx->use_value_sexagesimal_format = options.use_value_sexagesimal_format;
|
||||
tctx->show_optional_fields = options.show_optional_fields;
|
||||
|
||||
if (nb_sections > SECTION_MAX_NB_SECTIONS) {
|
||||
av_log(tctx, AV_LOG_ERROR, "The number of section definitions (%d) is larger than the maximum allowed (%d)\n", nb_sections, SECTION_MAX_NB_SECTIONS);
|
||||
@@ -286,19 +289,23 @@ void avtext_print_section_footer(AVTextFormatContext *tctx)
|
||||
|
||||
void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t val, int flags)
|
||||
{
|
||||
const AVTextFormatSection *section;
|
||||
|
||||
av_assert0(tctx);
|
||||
|
||||
if (tctx->opts.show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER)
|
||||
if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER)
|
||||
return;
|
||||
|
||||
if (tctx->opts.show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO
|
||||
if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO
|
||||
&& (flags & AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
|
||||
&& !(tctx->formatter->flags & AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS))
|
||||
return;
|
||||
|
||||
av_assert0(key && tctx->level >= 0 && tctx->level < SECTION_MAX_NB_LEVELS);
|
||||
|
||||
if (!tctx->opts.is_key_selected || tctx->opts.is_key_selected(tctx, key)) {
|
||||
section = tctx->section[tctx->level];
|
||||
|
||||
if (section->show_all_entries || av_dict_get(section->entries_to_show, key, NULL, 0)) {
|
||||
tctx->formatter->print_integer(tctx, key, val);
|
||||
tctx->nb_item[tctx->level]++;
|
||||
}
|
||||
@@ -384,7 +391,7 @@ static char *value_string(const AVTextFormatContext *tctx, char *buf, int buf_si
|
||||
vali = uv.val.i;
|
||||
}
|
||||
|
||||
if (uv.unit == unit_second_str && tctx->opts.use_value_sexagesimal_format) {
|
||||
if (uv.unit == unit_second_str && tctx->use_value_sexagesimal_format) {
|
||||
double secs;
|
||||
int hours, mins;
|
||||
secs = vald;
|
||||
@@ -396,10 +403,10 @@ static char *value_string(const AVTextFormatContext *tctx, char *buf, int buf_si
|
||||
} else {
|
||||
const char *prefix_string = "";
|
||||
|
||||
if (tctx->opts.use_value_prefix && vald > 1) {
|
||||
if (tctx->use_value_prefix && vald > 1) {
|
||||
int64_t index;
|
||||
|
||||
if (uv.unit == unit_byte_str && tctx->opts.use_byte_value_binary_prefix) {
|
||||
if (uv.unit == unit_byte_str && tctx->use_byte_value_binary_prefix) {
|
||||
index = (int64_t)(log2(vald) / 10);
|
||||
index = av_clip64(index, 0, FF_ARRAY_ELEMS(si_prefixes) - 1);
|
||||
vald /= si_prefixes[index].bin_val;
|
||||
@@ -413,13 +420,13 @@ static char *value_string(const AVTextFormatContext *tctx, char *buf, int buf_si
|
||||
vali = (int64_t)vald;
|
||||
}
|
||||
|
||||
if (show_float || (tctx->opts.use_value_prefix && vald != (int64_t)vald))
|
||||
if (show_float || (tctx->use_value_prefix && vald != (int64_t)vald))
|
||||
snprintf(buf, buf_size, "%f", vald);
|
||||
else
|
||||
snprintf(buf, buf_size, "%"PRId64, vali);
|
||||
|
||||
av_strlcatf(buf, buf_size, "%s%s%s", *prefix_string || tctx->opts.show_value_unit ? " " : "",
|
||||
prefix_string, tctx->opts.show_value_unit ? uv.unit : "");
|
||||
av_strlcatf(buf, buf_size, "%s%s%s", *prefix_string || tctx->show_value_unit ? " " : "",
|
||||
prefix_string, tctx->show_value_unit ? uv.unit : "");
|
||||
}
|
||||
|
||||
return buf;
|
||||
@@ -445,15 +452,15 @@ int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char *
|
||||
|
||||
section = tctx->section[tctx->level];
|
||||
|
||||
if (tctx->opts.show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER)
|
||||
if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER)
|
||||
return 0;
|
||||
|
||||
if (tctx->opts.show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO
|
||||
if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO
|
||||
&& (flags & AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
|
||||
&& !(tctx->formatter->flags & AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS))
|
||||
return 0;
|
||||
|
||||
if (!tctx->opts.is_key_selected || tctx->opts.is_key_selected(tctx, key)) {
|
||||
if (section->show_all_entries || av_dict_get(section->entries_to_show, key, NULL, 0)) {
|
||||
if (flags & AV_TEXTFORMAT_PRINT_STRING_VALIDATE) {
|
||||
char *key1 = NULL, *val1 = NULL;
|
||||
ret = validate_string(tctx, &key1, key);
|
||||
@@ -509,57 +516,30 @@ void avtext_print_ts(AVTextFormatContext *tctx, const char *key, int64_t ts, int
|
||||
avtext_print_integer(tctx, key, ts, 0);
|
||||
}
|
||||
|
||||
static void print_data_xxd(AVBPrint *bp, const uint8_t *data, int size)
|
||||
{
|
||||
unsigned offset = 0;
|
||||
int i;
|
||||
|
||||
av_bprintf(bp, "\n");
|
||||
while (size) {
|
||||
av_bprintf(bp, "%08x: ", offset);
|
||||
int l = FFMIN(size, 16);
|
||||
for (i = 0; i < l; i++) {
|
||||
av_bprintf(bp, "%02x", data[i]);
|
||||
if (i & 1)
|
||||
av_bprintf(bp, " ");
|
||||
}
|
||||
av_bprint_chars(bp, ' ', 41 - 2 * i - i / 2);
|
||||
for (i = 0; i < l; i++)
|
||||
av_bprint_chars(bp, data[i] - 32U < 95 ? data[i] : '.', 1);
|
||||
av_bprintf(bp, "\n");
|
||||
offset += l;
|
||||
data += l;
|
||||
size -= l;
|
||||
}
|
||||
}
|
||||
|
||||
static void print_data_base64(AVBPrint *bp, const uint8_t *data, int size)
|
||||
{
|
||||
char buf[AV_BASE64_SIZE(60)];
|
||||
|
||||
av_bprintf(bp, "\n");
|
||||
while (size) {
|
||||
int l = FFMIN(size, 60);
|
||||
av_base64_encode(buf, sizeof(buf), data, l);
|
||||
av_bprintf(bp, "%s\n", buf);
|
||||
data += l;
|
||||
size -= l;
|
||||
}
|
||||
}
|
||||
void avtext_print_data(AVTextFormatContext *tctx, const char *key,
|
||||
const uint8_t *data, int size)
|
||||
{
|
||||
AVBPrint bp;
|
||||
unsigned offset = 0;
|
||||
int i;
|
||||
|
||||
av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||
switch (tctx->opts.data_dump_format) {
|
||||
case AV_TEXTFORMAT_DATADUMP_XXD:
|
||||
print_data_xxd(&bp, data, size);
|
||||
break;
|
||||
case AV_TEXTFORMAT_DATADUMP_BASE64:
|
||||
print_data_base64(&bp, data, size);
|
||||
break;
|
||||
default:
|
||||
av_unreachable("Invalid data dump type");
|
||||
av_bprintf(&bp, "\n");
|
||||
while (size) {
|
||||
av_bprintf(&bp, "%08x: ", offset);
|
||||
int l = FFMIN(size, 16);
|
||||
for (i = 0; i < l; i++) {
|
||||
av_bprintf(&bp, "%02x", data[i]);
|
||||
if (i & 1)
|
||||
av_bprintf(&bp, " ");
|
||||
}
|
||||
av_bprint_chars(&bp, ' ', 41 - 2 * i - i / 2);
|
||||
for (i = 0; i < l; i++)
|
||||
av_bprint_chars(&bp, data[i] - 32U < 95 ? data[i] : '.', 1);
|
||||
av_bprintf(&bp, "\n");
|
||||
offset += l;
|
||||
data += l;
|
||||
size -= l;
|
||||
}
|
||||
avtext_print_string(tctx, key, bp.str, 0);
|
||||
av_bprint_finalize(&bp, NULL);
|
||||
@@ -581,6 +561,34 @@ void avtext_print_data_hash(AVTextFormatContext *tctx, const char *key,
|
||||
avtext_print_string(tctx, key, buf, 0);
|
||||
}
|
||||
|
||||
void avtext_print_integers(AVTextFormatContext *tctx, const char *key,
|
||||
uint8_t *data, int size, const char *format,
|
||||
int columns, int bytes, int offset_add)
|
||||
{
|
||||
AVBPrint bp;
|
||||
unsigned offset = 0;
|
||||
|
||||
if (!key || !data || !format || columns <= 0 || bytes <= 0)
|
||||
return;
|
||||
|
||||
av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||
av_bprintf(&bp, "\n");
|
||||
while (size) {
|
||||
av_bprintf(&bp, "%08x: ", offset);
|
||||
for (int i = 0, l = FFMIN(size, columns); i < l; i++) {
|
||||
if (bytes == 1) av_bprintf(&bp, format, *data);
|
||||
else if (bytes == 2) av_bprintf(&bp, format, AV_RN16(data));
|
||||
else if (bytes == 4) av_bprintf(&bp, format, AV_RN32(data));
|
||||
data += bytes;
|
||||
size--;
|
||||
}
|
||||
av_bprintf(&bp, "\n");
|
||||
offset += offset_add;
|
||||
}
|
||||
avtext_print_string(tctx, key, bp.str, 0);
|
||||
av_bprint_finalize(&bp, NULL);
|
||||
}
|
||||
|
||||
static const char *writercontext_get_writer_name(void *p)
|
||||
{
|
||||
AVTextWriterContext *wctx = p;
|
||||
|
||||
@@ -57,7 +57,9 @@ typedef struct AVTextFormatSection {
|
||||
const int children_ids[SECTION_MAX_NB_CHILDREN + 1]; ///< list of children section IDS, terminated by -1
|
||||
const char *element_name; ///< name of the contained element, if provided
|
||||
const char *unique_name; ///< unique section name, in case the name is ambiguous
|
||||
AVDictionary *entries_to_show;
|
||||
const char *(*get_type)(const void *data); ///< function returning a type if defined, must be defined when SECTION_FLAG_HAS_TYPE is defined
|
||||
int show_all_entries;
|
||||
const char *id_key; ///< name of the key to be used as the id
|
||||
const char *src_id_key; ///< name of the key to be used as the source id for diagram connections
|
||||
const char *dest_id_key; ///< name of the key to be used as the target id for diagram connections
|
||||
@@ -89,11 +91,6 @@ typedef enum {
|
||||
AV_TEXTFORMAT_LINKTYPE_MANYTOMANY = AV_TEXTFORMAT_LINKTYPE_NONDIR,
|
||||
} AVTextFormatLinkType;
|
||||
|
||||
typedef enum {
|
||||
AV_TEXTFORMAT_DATADUMP_XXD,
|
||||
AV_TEXTFORMAT_DATADUMP_BASE64,
|
||||
} AVTextFormatDataDump;
|
||||
|
||||
typedef struct AVTextFormatter {
|
||||
const AVClass *priv_class; ///< private class of the formatter, if any
|
||||
int priv_size; ///< private size for the formatter context
|
||||
@@ -112,24 +109,6 @@ typedef struct AVTextFormatter {
|
||||
#define SECTION_MAX_NB_LEVELS 12
|
||||
#define SECTION_MAX_NB_SECTIONS 100
|
||||
|
||||
typedef struct AVTextFormatOptions {
|
||||
/**
|
||||
* Callback to discard certain elements based upon the key used.
|
||||
* It is called before any element with a key is printed.
|
||||
* If this callback is unset, all elements are printed.
|
||||
*
|
||||
* @retval 1 if the element is supposed to be printed
|
||||
* @retval 0 if the element is supposed to be discarded
|
||||
*/
|
||||
int (*is_key_selected)(struct AVTextFormatContext *tctx, const char *key);
|
||||
int show_optional_fields;
|
||||
int show_value_unit;
|
||||
int use_value_prefix;
|
||||
int use_byte_value_binary_prefix;
|
||||
int use_value_sexagesimal_format;
|
||||
AVTextFormatDataDump data_dump_format;
|
||||
} AVTextFormatOptions;
|
||||
|
||||
struct AVTextFormatContext {
|
||||
const AVClass *class; ///< class of the formatter
|
||||
const AVTextFormatter *formatter; ///< the AVTextFormatter of which this is an instance
|
||||
@@ -152,7 +131,11 @@ struct AVTextFormatContext {
|
||||
AVBPrint section_pbuf[SECTION_MAX_NB_LEVELS]; ///< generic print buffer dedicated to each section,
|
||||
/// used by various formatters
|
||||
|
||||
AVTextFormatOptions opts;
|
||||
int show_optional_fields;
|
||||
int show_value_unit;
|
||||
int use_value_prefix;
|
||||
int use_byte_value_binary_prefix;
|
||||
int use_value_sexagesimal_format;
|
||||
|
||||
struct AVHashContext *hash;
|
||||
|
||||
@@ -161,6 +144,14 @@ struct AVTextFormatContext {
|
||||
unsigned int string_validation_utf8_flags;
|
||||
};
|
||||
|
||||
typedef struct AVTextFormatOptions {
|
||||
int show_optional_fields;
|
||||
int show_value_unit;
|
||||
int use_value_prefix;
|
||||
int use_byte_value_binary_prefix;
|
||||
int use_value_sexagesimal_format;
|
||||
} AVTextFormatOptions;
|
||||
|
||||
#define AV_TEXTFORMAT_PRINT_STRING_OPTIONAL 1
|
||||
#define AV_TEXTFORMAT_PRINT_STRING_VALIDATE 2
|
||||
|
||||
@@ -190,6 +181,9 @@ void avtext_print_data(AVTextFormatContext *tctx, const char *key, const uint8_t
|
||||
|
||||
void avtext_print_data_hash(AVTextFormatContext *tctx, const char *key, const uint8_t *data, int size);
|
||||
|
||||
void avtext_print_integers(AVTextFormatContext *tctx, const char *key, uint8_t *data, int size,
|
||||
const char *format, int columns, int bytes, int offset_add);
|
||||
|
||||
const AVTextFormatter *avtext_get_formatter_by_name(const char *name);
|
||||
|
||||
extern const AVTextFormatter avtextformatter_default;
|
||||
|
||||
@@ -27,9 +27,10 @@
|
||||
#include "avtextformat.h"
|
||||
#include "tf_internal.h"
|
||||
#include "tf_mermaid.h"
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include <libavutil/mem.h>
|
||||
#include <libavutil/avassert.h>
|
||||
#include <libavutil/bprint.h>
|
||||
#include <libavutil/opt.h>
|
||||
|
||||
|
||||
static const char *init_directive = ""
|
||||
@@ -240,20 +241,6 @@ static void set_str(const char **dst, const char *src)
|
||||
*dst = av_strdup(src);
|
||||
}
|
||||
|
||||
static void mermaid_subgraph_complete_start(MermaidContext *mmc, AVTextFormatContext *tfc, int level) {
|
||||
struct section_data parent_sec_data = mmc->section_data[level];
|
||||
AVBPrint *parent_buf = &tfc->section_pbuf[level];
|
||||
|
||||
if (parent_sec_data.subgraph_start_incomplete) {
|
||||
if (parent_buf->len > 0)
|
||||
writer_printf(tfc, "%s", parent_buf->str);
|
||||
|
||||
writer_put_str(tfc, "</div>\"]\n");
|
||||
|
||||
mmc->section_data[level].subgraph_start_incomplete = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#define MM_INDENT() writer_printf(tfc, "%*c", mmc->indent_level * 2, ' ')
|
||||
|
||||
static void mermaid_print_section_header(AVTextFormatContext *tfc, const void *data)
|
||||
@@ -310,7 +297,19 @@ static void mermaid_print_section_header(AVTextFormatContext *tfc, const void *d
|
||||
}
|
||||
|
||||
if (parent_section && parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_SUBGRAPH) {
|
||||
mermaid_subgraph_complete_start(mmc, tfc, tfc->level - 1);
|
||||
|
||||
struct section_data parent_sec_data = mmc->section_data[tfc->level - 1];
|
||||
AVBPrint *parent_buf = &tfc->section_pbuf[tfc->level - 1];
|
||||
|
||||
if (parent_sec_data.subgraph_start_incomplete) {
|
||||
|
||||
if (parent_buf->len > 0)
|
||||
writer_printf(tfc, "%s", parent_buf->str);
|
||||
|
||||
writer_put_str(tfc, "</div>\"]\n");
|
||||
|
||||
mmc->section_data[tfc->level - 1].subgraph_start_incomplete = 0;
|
||||
}
|
||||
}
|
||||
|
||||
av_freep(&mmc->section_data[tfc->level].section_id);
|
||||
@@ -456,8 +455,6 @@ static void mermaid_print_section_footer(AVTextFormatContext *tfc)
|
||||
|
||||
} else if ((section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_SUBGRAPH)) {
|
||||
|
||||
mermaid_subgraph_complete_start(mmc, tfc, tfc->level);
|
||||
|
||||
MM_INDENT();
|
||||
writer_put_str(tfc, "end\n");
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ static av_cold int xml_init(AVTextFormatContext *wctx)
|
||||
return AVERROR(EINVAL); \
|
||||
}
|
||||
////CHECK_COMPLIANCE(show_private_data, "private");
|
||||
CHECK_COMPLIANCE(wctx->opts.show_value_unit, "unit");
|
||||
CHECK_COMPLIANCE(wctx->opts.use_value_prefix, "prefix");
|
||||
CHECK_COMPLIANCE(wctx->show_value_unit, "unit");
|
||||
CHECK_COMPLIANCE(wctx->use_value_prefix, "prefix");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -38,7 +38,6 @@ enum {
|
||||
};
|
||||
|
||||
struct ThreadQueue {
|
||||
int choked;
|
||||
int *finished;
|
||||
unsigned int nb_streams;
|
||||
|
||||
@@ -158,9 +157,6 @@ static int receive_locked(ThreadQueue *tq, int *stream_idx,
|
||||
{
|
||||
unsigned int nb_finished = 0;
|
||||
|
||||
if (tq->choked)
|
||||
return AVERROR(EAGAIN);
|
||||
|
||||
while (av_container_fifo_read(tq->fifo, data, 0) >= 0) {
|
||||
unsigned idx;
|
||||
int ret;
|
||||
@@ -234,7 +230,6 @@ void tq_send_finish(ThreadQueue *tq, unsigned int stream_idx)
|
||||
* next time the consumer thread tries to read this stream it will get
|
||||
* an EOF and recv-finished flag will be set */
|
||||
tq->finished[stream_idx] |= FINISHED_SEND;
|
||||
tq->choked = 0;
|
||||
pthread_cond_broadcast(&tq->cond);
|
||||
|
||||
pthread_mutex_unlock(&tq->lock);
|
||||
@@ -254,15 +249,3 @@ void tq_receive_finish(ThreadQueue *tq, unsigned int stream_idx)
|
||||
|
||||
pthread_mutex_unlock(&tq->lock);
|
||||
}
|
||||
|
||||
void tq_choke(ThreadQueue *tq, int choked)
|
||||
{
|
||||
pthread_mutex_lock(&tq->lock);
|
||||
|
||||
int prev_choked = tq->choked;
|
||||
tq->choked = choked;
|
||||
if (choked != prev_choked)
|
||||
pthread_cond_broadcast(&tq->cond);
|
||||
|
||||
pthread_mutex_unlock(&tq->lock);
|
||||
}
|
||||
|
||||
@@ -58,15 +58,6 @@ int tq_send(ThreadQueue *tq, unsigned int stream_idx, void *data);
|
||||
*/
|
||||
void tq_send_finish(ThreadQueue *tq, unsigned int stream_idx);
|
||||
|
||||
/**
|
||||
* Prevent further reads from the thread queue until it is unchoked. Threads
|
||||
* attempting to read from the queue will block, similar to when the queue is
|
||||
* empty.
|
||||
*
|
||||
* @param choked 1 to choke, 0 to unchoke
|
||||
*/
|
||||
void tq_choke(ThreadQueue *tq, int choked);
|
||||
|
||||
/**
|
||||
* Read the next item from the queue.
|
||||
*
|
||||
|
||||
@@ -198,6 +198,7 @@ const FFCodec ff_eightsvx_fib_decoder = {
|
||||
FF_CODEC_DECODE_CB(eightsvx_decode_frame),
|
||||
.close = eightsvx_decode_close,
|
||||
.p.capabilities = AV_CODEC_CAP_DR1,
|
||||
CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_U8P),
|
||||
};
|
||||
#endif
|
||||
#if CONFIG_EIGHTSVX_EXP_DECODER
|
||||
@@ -211,5 +212,6 @@ const FFCodec ff_eightsvx_exp_decoder = {
|
||||
FF_CODEC_DECODE_CB(eightsvx_decode_frame),
|
||||
.close = eightsvx_decode_close,
|
||||
.p.capabilities = AV_CODEC_CAP_DR1,
|
||||
CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_U8P),
|
||||
};
|
||||
#endif
|
||||
|
||||
+25
-50
@@ -15,7 +15,6 @@ HEADERS = ac3_parser.h \
|
||||
dirac.h \
|
||||
dv_profile.h \
|
||||
dxva2.h \
|
||||
exif.h \
|
||||
jni.h \
|
||||
mediacodec.h \
|
||||
packet.h \
|
||||
@@ -43,10 +42,10 @@ OBJS = ac3_parser.o \
|
||||
dirac.o \
|
||||
dv_profile.o \
|
||||
encode.o \
|
||||
exif.o \
|
||||
get_buffer.o \
|
||||
imgconvert.o \
|
||||
jni.o \
|
||||
lcevcdec.o \
|
||||
mathtables.o \
|
||||
mediacodec.o \
|
||||
mpeg12framerate.o \
|
||||
@@ -57,7 +56,6 @@ OBJS = ac3_parser.o \
|
||||
qsv_api.o \
|
||||
raw.o \
|
||||
threadprogress.o \
|
||||
tiff_common.o \
|
||||
utils.o \
|
||||
version.o \
|
||||
vlc.o \
|
||||
@@ -88,10 +86,9 @@ OBJS-$(CONFIG_CABAC) += cabac.o
|
||||
OBJS-$(CONFIG_CBS) += cbs.o cbs_bsf.o
|
||||
OBJS-$(CONFIG_CBS_APV) += cbs_apv.o
|
||||
OBJS-$(CONFIG_CBS_AV1) += cbs_av1.o
|
||||
OBJS-$(CONFIG_CBS_H264) += cbs_h264.o cbs_h2645.o cbs_sei.o h2645_parse.o
|
||||
OBJS-$(CONFIG_CBS_H265) += cbs_h265.o cbs_h2645.o cbs_sei.o h2645_parse.o
|
||||
OBJS-$(CONFIG_CBS_H266) += cbs_h266.o cbs_h2645.o cbs_sei.o h2645_parse.o
|
||||
OBJS-$(CONFIG_CBS_LCEVC) += cbs_lcevc.o cbs_h2645.o cbs_sei.o h2645_parse.o
|
||||
OBJS-$(CONFIG_CBS_H264) += cbs_h2645.o cbs_sei.o h2645_parse.o
|
||||
OBJS-$(CONFIG_CBS_H265) += cbs_h2645.o cbs_sei.o h2645_parse.o
|
||||
OBJS-$(CONFIG_CBS_H266) += cbs_h2645.o cbs_sei.o h2645_parse.o
|
||||
OBJS-$(CONFIG_CBS_JPEG) += cbs_jpeg.o
|
||||
OBJS-$(CONFIG_CBS_MPEG2) += cbs_mpeg2.o
|
||||
OBJS-$(CONFIG_CBS_VP8) += cbs_vp8.o vp8data.o
|
||||
@@ -103,6 +100,7 @@ OBJS-$(CONFIG_DOVI_RPUDEC) += dovi_rpu.o dovi_rpudec.o
|
||||
OBJS-$(CONFIG_DOVI_RPUENC) += dovi_rpu.o dovi_rpuenc.o
|
||||
OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o
|
||||
OBJS-$(CONFIG_EVCPARSE) += evc_parse.o evc_ps.o
|
||||
OBJS-$(CONFIG_EXIF) += exif.o tiff_common.o
|
||||
OBJS-$(CONFIG_FAANDCT) += faandct.o
|
||||
OBJS-$(CONFIG_FAANIDCT) += faanidct.o
|
||||
OBJS-$(CONFIG_FDCTDSP) += fdctdsp.o jfdctfst.o jfdctint.o
|
||||
@@ -130,7 +128,6 @@ OBJS-$(CONFIG_IVIDSP) += ivi_dsp.o
|
||||
OBJS-$(CONFIG_JNI) += ffjni.o jni.o
|
||||
OBJS-$(CONFIG_JPEGTABLES) += jpegtables.o
|
||||
OBJS-$(CONFIG_LCMS2) += fflcms2.o
|
||||
OBJS-$(CONFIG_LIBLCEVC_DEC) += lcevcdec.o
|
||||
OBJS-$(CONFIG_LLAUDDSP) += lossless_audiodsp.o
|
||||
OBJS-$(CONFIG_LLVIDDSP) += lossless_videodsp.o
|
||||
OBJS-$(CONFIG_LLVIDENCDSP) += lossless_videoencdsp.o
|
||||
@@ -159,7 +156,7 @@ OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \
|
||||
motion_est.o ratecontrol.o
|
||||
OBJS-$(CONFIG_MPEGVIDEOENCDSP) += mpegvideoencdsp.o
|
||||
OBJS-$(CONFIG_MSMPEG4DEC) += msmpeg4dec.o msmpeg4.o msmpeg4data.o \
|
||||
msmpeg4_vc1_data.o mpeg4videodec.o
|
||||
msmpeg4_vc1_data.o
|
||||
OBJS-$(CONFIG_MSMPEG4ENC) += msmpeg4enc.o msmpeg4.o msmpeg4data.o \
|
||||
msmpeg4_vc1_data.o
|
||||
OBJS-$(CONFIG_MSS34DSP) += mss34dsp.o jpegquanttables.o
|
||||
@@ -183,6 +180,7 @@ OBJS-$(CONFIG_AV1_AMF_DECODER) += amfdec.o
|
||||
OBJS-$(CONFIG_VC1DSP) += vc1dsp.o
|
||||
OBJS-$(CONFIG_VIDEODSP) += videodsp.o
|
||||
OBJS-$(CONFIG_VP3DSP) += vp3dsp.o
|
||||
OBJS-$(CONFIG_VP56DSP) += vp56dsp.o
|
||||
OBJS-$(CONFIG_VP8DSP) += vp8dsp.o
|
||||
OBJS-$(CONFIG_V4L2_M2M) += v4l2_m2m.o v4l2_context.o v4l2_buffers.o v4l2_fmt.o
|
||||
OBJS-$(CONFIG_WMA_FREQS) += wma_freqs.o
|
||||
@@ -195,13 +193,11 @@ OBJS-$(CONFIG_A64MULTI5_ENCODER) += a64multienc.o elbg.o
|
||||
OBJS-$(CONFIG_AAC_DECODER) += aactab.o \
|
||||
aacsbr.o aacps_common.o aacps_float.o \
|
||||
kbdwin.o \
|
||||
sbrdsp.o aacpsdsp_float.o cbrt_data.o \
|
||||
$(if $(!CONFIG_HARDCODED_TABLES), cbrt_tablegen_common.o)
|
||||
sbrdsp.o aacpsdsp_float.o cbrt_data.o
|
||||
OBJS-$(CONFIG_AAC_FIXED_DECODER) += aactab.o \
|
||||
aacsbr_fixed.o aacps_common.o aacps_fixed.o \
|
||||
kbdwin.o \
|
||||
sbrdsp_fixed.o aacpsdsp_fixed.o cbrt_data_fixed.o \
|
||||
$(if $(!CONFIG_HARDCODED_TABLES), cbrt_tablegen_common.o)
|
||||
sbrdsp_fixed.o aacpsdsp_fixed.o cbrt_data_fixed.o
|
||||
OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \
|
||||
aacpsy.o aactab.o \
|
||||
aacenc_is.o \
|
||||
@@ -221,7 +217,6 @@ OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3enc.o ac3tab.o ac3.o
|
||||
OBJS-$(CONFIG_AC3_MF_ENCODER) += mfenc.o mf_utils.o
|
||||
OBJS-$(CONFIG_ACELP_KELVIN_DECODER) += g729dec.o lsp.o celp_filters.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o g729postfilter.o
|
||||
OBJS-$(CONFIG_AGM_DECODER) += agm.o jpegquanttables.o
|
||||
OBJS-$(CONFIG_AHX_DECODER) += mpegaudiodec_float.o
|
||||
OBJS-$(CONFIG_AIC_DECODER) += aic.o
|
||||
OBJS-$(CONFIG_ALAC_DECODER) += alac.o alac_data.o alacdsp.o
|
||||
OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o alac_data.o
|
||||
@@ -274,7 +269,6 @@ OBJS-$(CONFIG_AURA_DECODER) += cyuv.o
|
||||
OBJS-$(CONFIG_AURA2_DECODER) += aura.o
|
||||
OBJS-$(CONFIG_AV1_DECODER) += av1dec.o av1_parse.o
|
||||
OBJS-$(CONFIG_AV1_CUVID_DECODER) += cuviddec.o
|
||||
OBJS-$(CONFIG_AV1_D3D12VA_ENCODER) += d3d12va_encode_av1.o av1_levels.o
|
||||
OBJS-$(CONFIG_AV1_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
OBJS-$(CONFIG_AV1_MEDIACODEC_ENCODER) += mediacodecenc.o
|
||||
OBJS-$(CONFIG_AV1_NVENC_ENCODER) += nvenc_av1.o nvenc.o
|
||||
@@ -433,8 +427,6 @@ OBJS-$(CONFIG_H264_DECODER) += h264dec.o h264_cabac.o h264_cavlc.o \
|
||||
OBJS-$(CONFIG_H264_AMF_ENCODER) += amfenc_h264.o
|
||||
OBJS-$(CONFIG_H264_AMF_DECODER) += amfdec.o
|
||||
OBJS-$(CONFIG_H264_CUVID_DECODER) += cuviddec.o
|
||||
OBJS-$(CONFIG_H264_D3D12VA_ENCODER) += d3d12va_encode_h264.o h264_levels.o \
|
||||
h2645data.o hw_base_encode_h264.o
|
||||
OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
OBJS-$(CONFIG_H264_MEDIACODEC_ENCODER) += mediacodecenc.o
|
||||
OBJS-$(CONFIG_H264_MF_ENCODER) += mfenc.o mf_utils.o
|
||||
@@ -446,7 +438,6 @@ OBJS-$(CONFIG_H264_OMX_ENCODER) += omx.o
|
||||
OBJS-$(CONFIG_H264_QSV_DECODER) += qsvdec.o
|
||||
OBJS-$(CONFIG_H264_QSV_ENCODER) += qsvenc_h264.o
|
||||
OBJS-$(CONFIG_H264_RKMPP_DECODER) += rkmppdec.o
|
||||
OBJS-$(CONFIG_H264_RKMPP_ENCODER) += rkmppenc.o
|
||||
OBJS-$(CONFIG_H264_VAAPI_ENCODER) += vaapi_encode_h264.o h264_levels.o \
|
||||
h2645data.o hw_base_encode_h264.o
|
||||
OBJS-$(CONFIG_H264_VULKAN_ENCODER) += vulkan_encode.o vulkan_encode_h264.o \
|
||||
@@ -476,7 +467,6 @@ OBJS-$(CONFIG_HEVC_OH_ENCODER) += ohcodec.o ohenc.o
|
||||
OBJS-$(CONFIG_HEVC_QSV_DECODER) += qsvdec.o
|
||||
OBJS-$(CONFIG_HEVC_QSV_ENCODER) += qsvenc_hevc.o hevc/ps_enc.o
|
||||
OBJS-$(CONFIG_HEVC_RKMPP_DECODER) += rkmppdec.o
|
||||
OBJS-$(CONFIG_HEVC_RKMPP_ENCODER) += rkmppenc.o
|
||||
OBJS-$(CONFIG_HEVC_VAAPI_ENCODER) += vaapi_encode_h265.o h265_profile_level.o \
|
||||
h2645data.o hw_base_encode_h265.o
|
||||
OBJS-$(CONFIG_HEVC_VULKAN_ENCODER) += vulkan_encode.o vulkan_encode_h265.o \
|
||||
@@ -569,20 +559,19 @@ OBJS-$(CONFIG_MPC7_DECODER) += mpc7.o mpc.o
|
||||
OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o
|
||||
OBJS-$(CONFIG_MPEGVIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
|
||||
OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
|
||||
OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o
|
||||
OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpeg12.o
|
||||
OBJS-$(CONFIG_MPEG1_CUVID_DECODER) += cuviddec.o
|
||||
OBJS-$(CONFIG_MPEG1_V4L2M2M_DECODER) += v4l2_m2m_dec.o
|
||||
OBJS-$(CONFIG_MPEG2_MMAL_DECODER) += mmaldec.o
|
||||
OBJS-$(CONFIG_MPEG2_QSV_DECODER) += qsvdec.o
|
||||
OBJS-$(CONFIG_MPEG2_QSV_ENCODER) += qsvenc_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o
|
||||
OBJS-$(CONFIG_MPEG2_CUVID_DECODER) += cuviddec.o
|
||||
OBJS-$(CONFIG_MPEG2_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
OBJS-$(CONFIG_MPEG2_VAAPI_ENCODER) += vaapi_encode_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2_V4L2M2M_DECODER) += v4l2_m2m_dec.o
|
||||
OBJS-$(CONFIG_MPEG4_DECODER) += mpeg4videodec.o mpeg4videodsp.o \
|
||||
xvididct.o
|
||||
OBJS-$(CONFIG_MPEG4_DECODER) += mpeg4videodsp.o xvididct.o
|
||||
OBJS-$(CONFIG_MPEG4_ENCODER) += mpeg4videoenc.o
|
||||
OBJS-$(CONFIG_MPEG4_CUVID_DECODER) += cuviddec.o
|
||||
OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
@@ -647,8 +636,7 @@ OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o
|
||||
OBJS-$(CONFIG_PRORES_DECODER) += proresdec.o proresdsp.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_AW_ENCODER) += proresenc_anatoliy.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_KS_ENCODER) += proresenc_kostya.o proresdata.o proresenc_kostya_common.o
|
||||
OBJS-$(CONFIG_PRORES_KS_VULKAN_ENCODER) += proresenc_kostya_vulkan.o proresdata.o proresenc_kostya_common.o
|
||||
OBJS-$(CONFIG_PRORES_KS_ENCODER) += proresenc_kostya.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_RAW_DECODER) += prores_raw.o proresdsp.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
|
||||
OBJS-$(CONFIG_PROSUMER_DECODER) += prosumer.o
|
||||
@@ -807,8 +795,7 @@ OBJS-$(CONFIG_VORBIS_DECODER) += vorbisdec.o vorbisdsp.o vorbis.o \
|
||||
OBJS-$(CONFIG_VORBIS_ENCODER) += vorbisenc.o vorbis.o \
|
||||
vorbis_data.o
|
||||
OBJS-$(CONFIG_VP3_DECODER) += vp3.o jpegquanttables.o
|
||||
OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o \
|
||||
vp5dsp.o vpx_rac.o
|
||||
OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o vpx_rac.o
|
||||
OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \
|
||||
vp6dsp.o vpx_rac.o
|
||||
OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp8data.o vpx_rac.o
|
||||
@@ -856,8 +843,8 @@ OBJS-$(CONFIG_WMAV2_ENCODER) += wmaenc.o wma.o wma_common.o aactab.o
|
||||
OBJS-$(CONFIG_WMAVOICE_DECODER) += wmavoice.o \
|
||||
celp_filters.o \
|
||||
acelp_vectors.o acelp_filters.o
|
||||
OBJS-$(CONFIG_WMV2_DECODER) += wmv2dec.o wmv2data.o
|
||||
OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2data.o
|
||||
OBJS-$(CONFIG_WMV2_DECODER) += wmv2dec.o wmv2.o wmv2data.o
|
||||
OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2.o wmv2data.o
|
||||
OBJS-$(CONFIG_WNV1_DECODER) += wnv1.o
|
||||
OBJS-$(CONFIG_WRAPPED_AVFRAME_DECODER) += wrapped_avframe.o
|
||||
OBJS-$(CONFIG_WRAPPED_AVFRAME_ENCODER) += wrapped_avframe.o
|
||||
@@ -966,7 +953,6 @@ OBJS-$(CONFIG_ADPCM_AGM_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_AICA_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_ARGO_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_ARGO_ENCODER) += adpcm.o adpcm_data.o adpcmenc.o
|
||||
OBJS-$(CONFIG_ADPCM_CIRCUS_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_CT_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_DTK_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_EA_DECODER) += adpcm.o adpcm_data.o
|
||||
@@ -995,14 +981,9 @@ OBJS-$(CONFIG_ADPCM_IMA_DK3_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_DK4_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_EA_EACS_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_EA_SEAD_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_ESCAPE_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_HVQM2_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_HVQM4_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_ISS_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_MAGIX_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_MOFLEX_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_MTF_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_PDA_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_OKI_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_QT_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_QT_ENCODER) += adpcmenc.o adpcm_data.o
|
||||
@@ -1018,9 +999,7 @@ OBJS-$(CONFIG_ADPCM_IMA_XBOX_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_MS_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_MS_ENCODER) += adpcmenc.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_MTAF_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_N64_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_PSX_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_PSXC_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_SANYO_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_SBPRO_2_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_SBPRO_3_DECODER) += adpcm.o adpcm_data.o
|
||||
@@ -1029,7 +1008,7 @@ OBJS-$(CONFIG_ADPCM_SWF_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_SWF_ENCODER) += adpcmenc.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_THP_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_THP_LE_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_VIMA_DECODER) += vima.o adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_VIMA_DECODER) += vima.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_XA_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_XMD_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_YAMAHA_DECODER) += adpcm.o adpcm_data.o
|
||||
@@ -1054,7 +1033,6 @@ OBJS-$(CONFIG_AV1_VAAPI_HWACCEL) += vaapi_av1.o
|
||||
OBJS-$(CONFIG_AV1_VDPAU_HWACCEL) += vdpau_av1.o
|
||||
OBJS-$(CONFIG_AV1_VIDEOTOOLBOX_HWACCEL) += videotoolbox_av1.o
|
||||
OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_decode.o vulkan_av1.o
|
||||
OBJS-$(CONFIG_DPX_VULKAN_HWACCEL) += vulkan_decode.o vulkan_dpx.o
|
||||
OBJS-$(CONFIG_FFV1_VULKAN_HWACCEL) += vulkan_decode.o ffv1_vulkan.o vulkan_ffv1.o
|
||||
OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
|
||||
OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
|
||||
@@ -1112,7 +1090,6 @@ OBJS-$(CONFIG_VP9_VULKAN_HWACCEL) += vulkan_decode.o vulkan_vp9.o
|
||||
OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec.o
|
||||
OBJS-$(CONFIG_VVC_VAAPI_HWACCEL) += vaapi_vvc.o
|
||||
OBJS-$(CONFIG_PRORES_RAW_VULKAN_HWACCEL) += vulkan_decode.o vulkan_prores_raw.o
|
||||
OBJS-$(CONFIG_PRORES_VULKAN_HWACCEL) += vulkan_decode.o vulkan_prores.o
|
||||
|
||||
# Objects duplicated from other libraries for shared builds
|
||||
SHLIBOBJS += log2_tab.o reverse.o
|
||||
@@ -1190,7 +1167,6 @@ OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
|
||||
OBJS-$(CONFIG_LIBLC3_ENCODER) += liblc3enc.o
|
||||
OBJS-$(CONFIG_LIBLC3_DECODER) += liblc3dec.o
|
||||
OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
|
||||
OBJS-$(CONFIG_LIBMPEGHDEC_DECODER) += libmpeghdec.o
|
||||
OBJS-$(CONFIG_LIBOAPV_ENCODER) += liboapvenc.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o
|
||||
@@ -1208,8 +1184,6 @@ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o
|
||||
OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o
|
||||
OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o
|
||||
OBJS-$(CONFIG_LIBSVTAV1_ENCODER) += libsvtav1.o
|
||||
OBJS-$(CONFIG_LIBSVTJPEGXS_DECODER) += libsvtjpegxsdec.o
|
||||
OBJS-$(CONFIG_LIBSVTJPEGXS_ENCODER) += libsvtjpegxsenc.o
|
||||
OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o
|
||||
OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o
|
||||
OBJS-$(CONFIG_LIBUAVS3D_DECODER) += libuavs3d.o
|
||||
@@ -1240,7 +1214,6 @@ OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o
|
||||
OBJS-$(CONFIG_AC3_PARSER) += aac_ac3_parser.o ac3tab.o \
|
||||
ac3_channel_layout_tab.o
|
||||
OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o
|
||||
OBJS-$(CONFIG_AHX_PARSER) += ahx_parser.o
|
||||
OBJS-$(CONFIG_AMR_PARSER) += amr_parser.o
|
||||
OBJS-$(CONFIG_APV_PARSER) += apv_parser.o
|
||||
OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o av1_parse.o
|
||||
@@ -1276,22 +1249,20 @@ OBJS-$(CONFIG_HDR_PARSER) += hdr_parser.o
|
||||
OBJS-$(CONFIG_IPU_PARSER) += ipu_parser.o
|
||||
OBJS-$(CONFIG_JPEG2000_PARSER) += jpeg2000_parser.o
|
||||
OBJS-$(CONFIG_JPEGXL_PARSER) += jpegxl_parser.o jpegxl_parse.o
|
||||
OBJS-$(CONFIG_JPEGXS_PARSER) += jpegxs_parser.o
|
||||
OBJS-$(CONFIG_LCEVC_PARSER) += lcevc_parser.o
|
||||
OBJS-$(CONFIG_MISC4_PARSER) += misc4_parser.o
|
||||
OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg_parser.o
|
||||
OBJS-$(CONFIG_MLP_PARSER) += mlp_parse.o mlp_parser.o mlp.o
|
||||
OBJS-$(CONFIG_MPEG4VIDEO_PARSER) += mpeg4video_parser.o h263.o \
|
||||
mpeg4videodec.o mpeg4video.o \
|
||||
ituh263dec.o h263data.o
|
||||
ituh263dec.o h263dec.o h263data.o
|
||||
OBJS-$(CONFIG_MPEGAUDIO_PARSER) += mpegaudio_parser.o
|
||||
OBJS-$(CONFIG_MPEGVIDEO_PARSER) += mpegvideo_parser.o mpeg12data.o
|
||||
OBJS-$(CONFIG_MPEGVIDEO_PARSER) += mpegvideo_parser.o \
|
||||
mpeg12.o mpeg12data.o
|
||||
OBJS-$(CONFIG_OPUS_PARSER) += vorbis_data.o
|
||||
OBJS-$(CONFIG_PNG_PARSER) += png_parser.o
|
||||
OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o
|
||||
OBJS-$(CONFIG_PRORES_RAW_PARSER) += prores_raw_parser.o
|
||||
OBJS-$(CONFIG_QOI_PARSER) += qoi_parser.o
|
||||
OBJS-$(CONFIG_PRORES_PARSER) += prores_parser.o
|
||||
OBJS-$(CONFIG_RV34_PARSER) += rv34_parser.o
|
||||
OBJS-$(CONFIG_SBC_PARSER) += sbc_parser.o
|
||||
OBJS-$(CONFIG_SIPR_PARSER) += sipr_parser.o
|
||||
@@ -1323,6 +1294,10 @@ OBJS-$(HAVE_THREADS) += pthread.o pthread_slice.o pthread_fram
|
||||
|
||||
OBJS-$(CONFIG_FRAME_THREAD_ENCODER) += frame_thread_encoder.o
|
||||
|
||||
# vulkan libs
|
||||
OBJS-$(CONFIG_LIBGLSLANG) += vulkan_glslang.o
|
||||
OBJS-$(CONFIG_LIBSHADERC) += vulkan_shaderc.o
|
||||
|
||||
# Windows resource file
|
||||
SHLIBOBJS-$(HAVE_GNU_WINDRES) += avcodecres.o
|
||||
|
||||
@@ -1357,7 +1332,7 @@ SKIPHEADERS-$(CONFIG_QSVENC) += qsvenc.h
|
||||
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_hevc.h vaapi_encode.h
|
||||
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h
|
||||
SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
|
||||
SKIPHEADERS-$(CONFIG_VULKAN) += ffv1_vulkan.h prores_vulkan.h vulkan_video.h \
|
||||
SKIPHEADERS-$(CONFIG_VULKAN) += ffv1_vulkan.h vulkan_video.h \
|
||||
vulkan_encode.h vulkan_decode.h
|
||||
SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h v4l2_m2m.h
|
||||
SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h
|
||||
|
||||
@@ -36,10 +36,6 @@
|
||||
#define TNS_MAX_ORDER 20
|
||||
#define MAX_LTP_LONG_SFB 40
|
||||
|
||||
#define MPS_MAX_PARAM_SETS 9
|
||||
#define MPS_MAX_PARAM_BANDS 28
|
||||
#define MPS_MAX_TIME_SLOTS 16 /* 64 in non-AAC MPEG Surround */
|
||||
|
||||
enum RawDataBlockType {
|
||||
TYPE_SCE,
|
||||
TYPE_CPE,
|
||||
|
||||
@@ -3,7 +3,6 @@ clean::
|
||||
|
||||
OBJS-$(CONFIG_AAC_DECODER) += aac/aacdec.o aac/aacdec_tab.o \
|
||||
aac/aacdec_float.o aac/aacdec_usac.o \
|
||||
aac/aacdec_ac.o aac/aacdec_lpd.o \
|
||||
aac/aacdec_usac_mps212.o
|
||||
aac/aacdec_ac.o aac/aacdec_lpd.o
|
||||
OBJS-$(CONFIG_AAC_FIXED_DECODER) += aac/aacdec.o aac/aacdec_tab.o \
|
||||
aac/aacdec_fixed.o
|
||||
|
||||
@@ -164,12 +164,6 @@ static av_cold int che_configure(AACDecContext *ac,
|
||||
}
|
||||
} else {
|
||||
if (ac->che[type][id]) {
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(ac->tag_che_map); i++) {
|
||||
for (int j = 0; j < MAX_ELEM_ID; j++) {
|
||||
if (ac->tag_che_map[i][j] == ac->che[type][id])
|
||||
ac->tag_che_map[i][j] = NULL;
|
||||
}
|
||||
}
|
||||
ac->proc.sbr_ctx_close(ac->che[type][id]);
|
||||
}
|
||||
av_freep(&ac->che[type][id]);
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "libavcodec/mpeg4audio.h"
|
||||
|
||||
#include "aacdec_ac.h"
|
||||
#include "aacdec_usac_mps212.h"
|
||||
|
||||
typedef struct AACDecContext AACDecContext;
|
||||
|
||||
@@ -230,33 +229,6 @@ typedef struct SingleChannelElement {
|
||||
};
|
||||
} SingleChannelElement;
|
||||
|
||||
typedef struct AACUsacMPSData {
|
||||
/* Framing */
|
||||
int framing_type;
|
||||
int nb_param_sets;
|
||||
int param_sets[MPS_MAX_PARAM_SETS];
|
||||
|
||||
/* OTT */
|
||||
AACMPSLosslessData ott[MPS_ELE_NB];
|
||||
int ott_idx[MPS_ELE_NB][MPS_MAX_PARAM_SETS][MPS_MAX_PARAM_BANDS];
|
||||
bool opd_smoothing_mode;
|
||||
|
||||
/* SMG */
|
||||
int smooth_mode[MPS_MAX_PARAM_SETS];
|
||||
int smooth_time[MPS_MAX_PARAM_SETS];
|
||||
int freq_res_stride_smg[MPS_MAX_PARAM_SETS];
|
||||
bool smg_data[MPS_MAX_PARAM_SETS][MPS_MAX_PARAM_BANDS];
|
||||
|
||||
/* TSD */
|
||||
bool tsd_enable;
|
||||
bool temp_shape_enable;
|
||||
bool temp_shape_enable_ch[2];
|
||||
int16_t temp_shape_data[MPS_MAX_TIME_SLOTS];
|
||||
|
||||
int tsd_num_tr_slots;
|
||||
int tsd_phase_data[64];
|
||||
} AACUsacMPSData;
|
||||
|
||||
typedef struct AACUsacStereo {
|
||||
uint8_t common_window;
|
||||
uint8_t common_tw;
|
||||
@@ -272,8 +244,6 @@ typedef struct AACUsacStereo {
|
||||
|
||||
uint8_t pred_used[128];
|
||||
|
||||
AACUsacMPSData mps;
|
||||
|
||||
INTFLOAT_ALIGNED_UNION(32, alpha_q_re, 1024);
|
||||
INTFLOAT_ALIGNED_UNION(32, alpha_q_im, 1024);
|
||||
INTFLOAT_ALIGNED_UNION(32, prev_alpha_q_re, 1024);
|
||||
@@ -362,7 +332,6 @@ typedef struct AACUsacElemConfig {
|
||||
uint8_t high_rate_mode : 1; /* bsHighRateMode */
|
||||
uint8_t phase_coding : 1; /* bsPhaseCoding */
|
||||
|
||||
uint8_t otts_bands_phase_present; /* bsOttBandsPhasePresent */
|
||||
uint8_t otts_bands_phase; /* bsOttBandsPhase */
|
||||
uint8_t residual_coding; /* bsResidualCoding */
|
||||
uint8_t residual_bands; /* bsResidualBands */
|
||||
|
||||
+14
-491
@@ -258,499 +258,17 @@ static const int8_t sbr_vlc_offsets[10] = {
|
||||
-60, -60, -24, -24, -31, -31, -12, -12, -31, -12
|
||||
};
|
||||
|
||||
|
||||
const VLCElem *ff_aac_sbr_vlc[10];
|
||||
|
||||
static av_cold void init_sbr_tables(void)
|
||||
static av_cold void aacdec_common_init(void)
|
||||
{
|
||||
static VLCElem vlc_buf[(1098 + 1092 + 768 + 1026 + 1058 +
|
||||
static VLCElem vlc_buf[(304 + 270 + 550 + 300 + 328 +
|
||||
294 + 306 + 268 + 510 + 366 + 462) +
|
||||
(1098 + 1092 + 768 + 1026 + 1058 +
|
||||
1052 + 544 + 544 + 592 + 512)];
|
||||
VLCInitState state = VLC_INIT_STATE(vlc_buf);
|
||||
const uint8_t (*tab)[2] = sbr_huffman_tab;
|
||||
|
||||
// SBR VLC table initialization
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(ff_aac_sbr_vlc); i++) {
|
||||
ff_aac_sbr_vlc[i] =
|
||||
ff_vlc_init_tables_from_lengths(&state, 9, sbr_huffman_nb_codes[i],
|
||||
&tab[0][1], 2,
|
||||
&tab[0][0], 2, 1,
|
||||
sbr_vlc_offsets[i], 0);
|
||||
tab += sbr_huffman_nb_codes[i];
|
||||
}
|
||||
}
|
||||
|
||||
const int16_t ff_aac_hcod_firstband_CLD[30][2] = {
|
||||
{ 2, 1 }, { 4, 3 }, { 6, 5 }, { 8, 7 }, { 10, 9 },
|
||||
{ 12, 11 }, { 14, 13 }, { -8, 15 }, { -9, 16 }, { -10, 17 },
|
||||
{ -18, 18 }, { -17, -19 }, { -16, 19 }, { -11, -20 }, { -15, -21 },
|
||||
{ -7, 20 }, { -22, 21 }, { -12, -14 }, { -13, -23 }, { 23, 22 },
|
||||
{ -24, -31 }, { -6, 24 }, { -25, -26 }, { 26, 25 }, { -5, -27 },
|
||||
{ -28, 27 }, { -4, 28 }, { -29, 29 }, { -1, -30 }, { -2, -3 },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod1D_CLD[2 /* DT/DF */][30][2] = {
|
||||
{ { -1, 1 }, { -2, 2 }, { -3, 3 }, { -4, 4 }, { -5, 5 },
|
||||
{ -6, 6 }, { -7, 7 }, { 9, 8 }, { -8, 10 }, { -9, 11 },
|
||||
{ -10, 12 }, { -11, 13 }, { -12, 14 }, { -13, 15 }, { -14, 16 },
|
||||
{ -15, 17 }, { -16, 18 }, { -17, 19 }, { -18, 20 }, { -19, -20 },
|
||||
{ -21, 21 }, { -22, 22 }, { -23, 23 }, { 25, 24 }, { -24, 26 },
|
||||
{ -25, 27 }, { 29, 28 }, { -26, -31 }, { -29, -30 }, { -27, -28 }, },
|
||||
{ { -1, 1 }, { -2, 2 }, { -3, 3 }, { -4, 4 }, { -5, 5 },
|
||||
{ -6, 6 }, { -7, 7 }, { -8, 8 }, { -9, 9 }, { -10, 10 },
|
||||
{ -11, 11 }, { -12, 12 }, { -13, 13 }, { 15, 14 }, { -14, 16 },
|
||||
{ -15, 17 }, { -16, 18 }, { -17, 19 }, { -18, 20 }, { -19, 21 },
|
||||
{ -20, -21 }, { -23, 22 }, { -22, 23 }, { -24, 24 }, { -25, 25 },
|
||||
{ 27, 26 }, { 29, 28 }, { -30, -31 }, { -28, -29 }, { -26, -27 }, },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_CLD_03[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][15][2] = {
|
||||
{ { { -1, 1 }, { -52, 2 }, { 4, 3 }, { -2, 5 }, { -17, 6 },
|
||||
{ -18, 7 }, { -36, -51 }, { 9, 8 }, { -35, 10 }, { -34, 11 },
|
||||
{ -19, -33 }, { -3, 12 }, { -20, 13 }, { -50, 14 }, { -4, -49 }, },
|
||||
{ { -1, 1 }, { -52, 2 }, { -17, 3 }, { 5, 4 }, { -36, 6 },
|
||||
{ -33, 7 }, { -2, -18 }, { -20, 8 }, { 10, 9 }, { -34, -49 },
|
||||
{ -51, 11 }, { -35, 12 }, { -19, 13 }, { -3, 14 }, { -4, -50 }, }, },
|
||||
{ { { -1, 1 }, { -52, 2 }, { -17, 3 }, { 5, 4 }, { -2, -36 },
|
||||
{ -18, 6 }, { 8, 7 }, { -51, 9 }, { -33, 10 }, { -34, 11 },
|
||||
{ -20, -35 }, { -19, 12 }, { -3, 13 }, { -49, 14 }, { -4, -50 }, },
|
||||
{ { 2, 1 }, { -1, -52 }, { 4, 3 }, { -2, 5 }, { -51, 6 },
|
||||
{ -17, -18 }, { 8, 7 }, { 10, 9 }, { -3, -36 }, { -19, 11 },
|
||||
{ -35, -50 }, { -34, 12 }, { -4, 13 }, { -33, 14 }, { -20, -49 }, }, },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_CLD_05[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][35][2] = {
|
||||
{ { { 2, 1 }, { -86, 3 }, { 5, 4 }, { -1, 6 }, { 8, 7 },
|
||||
{ -17, -18 }, { -2, 9 }, { -70, 10 }, { -85, 11 }, { 13, 12 },
|
||||
{ -69, 14 }, { -34, 15 }, { 17, 16 }, { -19, 18 }, { -33, -35 },
|
||||
{ -54, 19 }, { -53, 20 }, { -3, 21 }, { -68, 22 }, { -84, 23 },
|
||||
{ -50, 24 }, { -52, 25 }, { -51, 26 }, { -20, -36 }, { -49, 27 },
|
||||
{ -38, 28 }, { -37, 29 }, { -4, -83 }, { -67, 30 }, { -66, 31 },
|
||||
{ -21, 32 }, { -22, -65 }, { -5, 33 }, { -82, 34 }, { -6, -81 }, },
|
||||
{ { 2, 1 }, { 4, 3 }, { -86, 5 }, { -1, 6 }, { -17, 7 },
|
||||
{ -70, 8 }, { 10, 9 }, { -18, 11 }, { -33, 12 }, { -54, 13 },
|
||||
{ -2, 14 }, { -34, 15 }, { -38, 16 }, { -49, 17 }, { -85, 18 },
|
||||
{ -50, 19 }, { -69, 20 }, { -53, -65 }, { -22, 21 }, { -66, 22 },
|
||||
{ -19, 23 }, { -37, 24 }, { -35, -81 }, { -3, 25 }, { -51, 26 },
|
||||
{ -68, -84 }, { -52, 27 }, { 29, 28 }, { -20, 30 }, { -4, -36 },
|
||||
{ -83, 31 }, { -67, 32 }, { -21, 33 }, { -5, 34 }, { -6, -82 }, }, },
|
||||
{ { { 2, 1 }, { -86, 3 }, { -1, 4 }, { -17, 5 }, { 7, 6 },
|
||||
{ -70, 8 }, { -2, -18 }, { 10, 9 }, { 12, 11 }, { -85, 13 },
|
||||
{ -33, 14 }, { -34, -54 }, { 16, 15 }, { -69, 17 }, { 19, 18 },
|
||||
{ -50, -53 }, { -19, 20 }, { -38, 21 }, { -35, -49 }, { -3, 22 },
|
||||
{ 24, 23 }, { -68, 25 }, { -84, 26 }, { -65, 27 }, { -51, -66 },
|
||||
{ -22, -37 }, { -52, 28 }, { -20, 29 }, { -36, 30 }, { -81, 31 },
|
||||
{ -4, -83 }, { -67, 32 }, { -21, 33 }, { -5, 34 }, { -6, -82 }, },
|
||||
{ { 2, 1 }, { 4, 3 }, { -86, 5 }, { 7, 6 }, { 9, 8 },
|
||||
{ -1, -2 }, { -85, 10 }, { -18, 11 }, { -17, 12 }, { 14, 13 },
|
||||
{ -70, 15 }, { 17, 16 }, { -19, -69 }, { -84, 18 }, { -3, 19 },
|
||||
{ 21, 20 }, { -34, -68 }, { -20, 22 }, { -35, 23 }, { -83, 24 },
|
||||
{ -33, 25 }, { -4, 26 }, { -53, 27 }, { -54, -67 }, { -36, 28 },
|
||||
{ -21, -52 }, { -82, 29 }, { -5, -50 }, { -51, 30 }, { -38, 31 },
|
||||
{ -37, -49 }, { -6, 32 }, { -66, 33 }, { -65, 34 }, { -22, -81 }, }, },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_CLD_07[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][63][2] = {
|
||||
{ { { 2, 1 }, { 4, 3 }, {-120, 5 }, { 7, 6 }, { 9, 8 },
|
||||
{ -1, 10 }, { -18, 11 }, { -17, 12 }, { -2,-104 }, {-119, 13 },
|
||||
{ 15, 14 }, {-103, 16 }, { 18, 17 }, { -34, 19 }, { -19, 20 },
|
||||
{ 22, 21 }, { -35, 23 }, { -33, 24 }, { -88, 25 }, { -87, 26 },
|
||||
{ 28, 27 }, { -3,-102 }, { -86, 29 }, { -52,-118 }, { 31, 30 },
|
||||
{ -50, 32 }, { -51, 33 }, { -70, 34 }, { -36, 35 }, { -85, 36 },
|
||||
{ -20, 37 }, { 39, 38 }, { -69, -71 }, { -72, 40 }, { -49, -67 },
|
||||
{ 42, 41 }, { -68, 43 }, { -4,-101 }, { -53,-117 }, { -37, 44 },
|
||||
{ -66, 45 }, { -55, 46 }, { 48, 47 }, { -54, 49 }, { -21, 50 },
|
||||
{ -84,-100 }, { -56, -65 }, { 52, 51 }, { -82, -83 }, { 54, 53 },
|
||||
{ -5,-116 }, { -22, 55 }, { -38, 56 }, { -39, -40 }, { 58, 57 },
|
||||
{ -81,-115 }, { -98, -99 }, { -6, 59 }, { -23, 60 }, { -24, 61 },
|
||||
{ -7, -97 }, {-114, 62 }, { -8,-113 }, },
|
||||
{ { 2, 1 }, { 4, 3 }, { 6, 5 }, {-120, 7 }, { -17, 8 },
|
||||
{ -1,-104 }, { 10, 9 }, { 12, 11 }, { -18, 13 }, { -33, -88 },
|
||||
{ 15, 14 }, { 17, 16 }, { -2, 18 }, { -34, 19 }, { -72, 20 },
|
||||
{ -49, 21 }, {-119, 22 }, { -50, 23 }, {-103, 24 }, { -56, 25 },
|
||||
{ -65, 26 }, { 28, 27 }, { -40, -87 }, { -66, 29 }, { -82, 30 },
|
||||
{ 32, 31 }, { -19, -81 }, { -71, 33 }, { -97, 34 }, { -35, -55 },
|
||||
{ -24, 35 }, { 37, 36 }, { -3, -98 }, { -51, 38 }, { -67, 39 },
|
||||
{ -39,-118 }, {-113, 40 }, {-102, 41 }, { -86, 42 }, { -70, -83 },
|
||||
{ 44, 43 }, { -20, -54 }, { -52, 45 }, { -36, 46 }, { -4, 47 },
|
||||
{ -68, 48 }, { -85, 49 }, {-101,-117 }, { -69, 50 }, { 52, 51 },
|
||||
{ -21, -37 }, { -53, 53 }, { 55, 54 }, { -5,-100 }, {-116, 56 },
|
||||
{ -84, 57 }, { -38, 58 }, { -22, -99 }, {-115, 59 }, { -6, 60 },
|
||||
{ -23, 61 }, { -7, 62 }, {-114, 0 }, }, },
|
||||
{ { { 2, 1 }, {-120, 3 }, { -1, 4 }, { 6, 5 }, { -17, 7 },
|
||||
{-104, 8 }, { -18, 9 }, { -2, 10 }, { 12, 11 }, { 14, 13 },
|
||||
{-119, 15 }, { -33, 16 }, { -34, -88 }, {-103, 17 }, { 19, 18 },
|
||||
{ 21, 20 }, { 23, 22 }, { 25, 24 }, { -19, -72 }, { -50, 26 },
|
||||
{ -49, 27 }, { -87, 28 }, { 30, 29 }, { 32, 31 }, { -3, -35 },
|
||||
{ 34, 33 }, { -56, 35 }, { -65, -66 }, { -40, 36 }, { -82,-118 },
|
||||
{ -71, 37 }, { -55, 38 }, { -67,-102 }, { -51, 39 }, { -70, 40 },
|
||||
{ 42, 41 }, { -81, 43 }, { -86, 44 }, { -52, -97 }, { -98, 45 },
|
||||
{ -24, -39 }, { -20, 46 }, { -54, -83 }, { -36, 47 }, { -85, 48 },
|
||||
{ -68, 49 }, { -4, 50 }, { -69,-113 }, {-117, 51 }, { -37,-101 },
|
||||
{ -53, 52 }, { -21, 53 }, { 55, 54 }, { -84,-100 }, { -5, 56 },
|
||||
{-116, 57 }, { -22, 58 }, { -38,-115 }, { 60, 59 }, { -6, -99 },
|
||||
{ -23, 61 }, {-114, 62 }, { -7, -8 }, },
|
||||
{ { 2, 1 }, { 4, 3 }, {-120, 5 }, { 7, 6 }, { 9, 8 },
|
||||
{ 11, 10 }, { -1, 12 }, { -18,-119 }, { -2, 13 }, { 15, 14 },
|
||||
{ -17, 16 }, {-104, 17 }, { 19, 18 }, { -19, 20 }, {-103, 21 },
|
||||
{-118, 22 }, { 24, 23 }, { -3, 25 }, { 27, 26 }, { -34, 28 },
|
||||
{-102, 29 }, { -20, 30 }, { -35, 31 }, { 33, 32 }, {-117, 34 },
|
||||
{ -33, 35 }, { -88, 36 }, { -4, 37 }, { -87, 38 }, { 40, 39 },
|
||||
{ -36,-101 }, { -86, 41 }, { -21, -37 }, { -85,-100 }, { -52, 42 },
|
||||
{ -22, 43 }, {-116, 44 }, { -50 , 45 }, { 47, 46 }, { -5, -51 },
|
||||
{-115, 48 }, { -70, 49 }, { -84, 50 }, { -38, -49 }, { -72, -99 },
|
||||
{ -53, 51 }, { -69, -71 }, { -23, 52 }, { -6, -67 }, {-114, 53 },
|
||||
{ -7, 54 }, { -66, -68 }, { -55, 55 }, { 57, 56 }, { -54, -65 },
|
||||
{ -8, -56 }, { -82, -83 }, { 59, 58 }, { -39, -40 }, { -81, 60 },
|
||||
{ -98, 61 }, { -97, 62 }, { -24,-113 }, }, },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_CLD_09[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][99][2] = {
|
||||
{ { { 2, 1 }, { 4, 3 }, {-154, 5 }, { 7, 6 }, { 9, 8 },
|
||||
{ 11, 10 }, { -1, 12 }, { -18, 13 }, { -17, 14 }, { -2,-138 },
|
||||
{ 16, 15 }, {-153, 17 }, {-137, 18 }, { 20, 19 }, { 22, 21 },
|
||||
{ -34, 23 }, { -19, 24 }, { -35, 25 }, { 27, 26 }, { 29, 28 },
|
||||
{-121, 30 }, {-120, 31 }, {-136, 32 }, { -33,-122 }, { 34, 33 },
|
||||
{-152, 35 }, { -3, 36 }, { -51, 37 }, { -52, 38 }, { -69, 39 },
|
||||
{ -36, 40 }, { -50, 41 }, { 43, 42 }, { -20, 44 }, {-104, 45 },
|
||||
{-103, 46 }, { -87, 47 }, {-119, 48 }, {-105, 49 }, { -86, 50 },
|
||||
{-102, 51 }, {-106, 52 }, { -49,-135 }, { -68, 53 }, { 55, 54 },
|
||||
{ -53, 56 }, { -67,-151 }, { -4, 57 }, { -84, 58 }, { -85, 59 },
|
||||
{ -66, 60 }, { -37, 61 }, { -70, 62 }, { -54, -88 }, { -21, 63 },
|
||||
{ 65, 64 }, { -89, 66 }, {-118, 67 }, { -72, 68 }, { -90, 69 },
|
||||
{ -71, 70 }, { -65,-134 }, {-150, 71 }, { -83, 72 }, { -5, 73 },
|
||||
{-101,-117 }, { -82, 74 }, { 76, 75 }, { -99, 77 }, { -38, 78 },
|
||||
{-100, 79 }, { -22, 80 }, { -73, 81 }, { -39, -74 }, { 83, 82 },
|
||||
{ -55, -81 }, { -57, 84 }, {-133,-149 }, { -56, 85 }, { -6, 86 },
|
||||
{ -98, 87 }, {-132, 88 }, { -23, 89 }, {-114, 90 }, {-116, 91 },
|
||||
{ -58,-115 }, { -24, 92 }, { -97,-148 }, { -40, -41 }, { -7, -42 },
|
||||
{-147, 93 }, { 95, 94 }, {-131, 96 }, { -8,-130 }, { -25,-113 },
|
||||
{ -9, 97 }, { -26,-129 }, {-146, 98 }, { -10,-145 }, },
|
||||
{ { 2, 1 }, { 4, 3 }, { 6, 5 }, {-154, 7 }, { 9, 8 },
|
||||
{ -17, 10 }, {-138, 11 }, { -1, 12 }, { 14, 13 }, { 16, 15 },
|
||||
{ -33,-122 }, { -18, 17 }, { 19, 18 }, { -34, 20 }, { -2, 21 },
|
||||
{-106, 22 }, { -49, 23 }, { 25, 24 }, { -50, 26 }, {-153, 27 },
|
||||
{ -90, 28 }, {-137, 29 }, { -65, 30 }, { 32, 31 }, { -66, 33 },
|
||||
{-121, 34 }, { -74, 35 }, { -81, 36 }, { 38, 37 }, { -42, 39 },
|
||||
{ -82, 40 }, {-105, 41 }, { -19,-114 }, { -58, 42 }, { -35, 43 },
|
||||
{ -97, 44 }, { 46, 45 }, {-129, 47 }, { -26, -89 }, { -57, -98 },
|
||||
{ -51, 48 }, { -3, 49 }, {-113, 50 }, {-130, 51 }, {-152, 52 },
|
||||
{ -67, -73 }, { -99,-136 }, {-145, 53 }, {-120, 54 }, { -41, 55 },
|
||||
{ -83, 56 }, { -72, 57 }, {-104, 58 }, {-115, 59 }, { -20, 60 },
|
||||
{ 62, 61 }, { -36, -88 }, { -84, 63 }, { -52, -56 }, { 65, 64 },
|
||||
{ -4, -87 }, { -68, 66 }, {-151, 67 }, {-100,-135 }, { 69, 68 },
|
||||
{ -69,-119 }, {-103, 70 }, { -71, 71 }, { 73, 72 }, { -21, 74 },
|
||||
{ -85, 75 }, { -37, -53 }, { -86, 76 }, { 78, 77 }, {-102,-150 },
|
||||
{ -5, 79 }, {-134, 80 }, {-118, 81 }, { -54,-117 }, { 83, 82 },
|
||||
{ -38, -70 }, { -22, 84 }, { -6, 85 }, { 87, 86 }, { -55, 88 },
|
||||
{-101, 89 }, {-133,-149 }, { -24, -39 }, { 91, 90 }, {-132, 92 },
|
||||
{ -23, 93 }, { -7, 94 }, {-147,-148 }, {-116,-131 }, { -25, 95 },
|
||||
{ -40, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, }, },
|
||||
{ { { 2, 1 }, {-154, 3 }, { 5, 4 }, { -1, 6 }, { 8, 7 },
|
||||
{ -17, 9 }, {-138, 10 }, { -18, 11 }, { -2, 12 }, { 14, 13 },
|
||||
{ 16, 15 }, {-153, 17 }, { -34, 18 }, { -33,-122 }, { 20, 19 },
|
||||
{ 22, 21 }, {-137, 23 }, { 25, 24 }, { 27, 26 }, {-106, 28 },
|
||||
{ 30, 29 }, { -50, 31 }, { -19, 32 }, { -49,-121 }, { 34, 33 },
|
||||
{ 36, 35 }, { -35, 37 }, { -90, 38 }, { -66, 39 }, { -3, 40 },
|
||||
{ 42, 41 }, { -65, 43 }, {-105, 44 }, { 46, 45 }, { -74, 47 },
|
||||
{ -51, 48 }, { -82,-152 }, {-136, 49 }, { -81, 50 }, { -42, -89 },
|
||||
{-114, 51 }, { 53, 52 }, { -57, -58 }, {-120, 54 }, { -98, 55 },
|
||||
{ -67, 56 }, { -97, 57 }, { 59, 58 }, { -99, 60 }, { -73,-104 },
|
||||
{ -72, 61 }, {-113, 62 }, { -20, -83 }, { -84,-130 }, { -36, 63 },
|
||||
{ -26, 64 }, { -41, 65 }, { -52,-129 }, { -87, -88 }, { 67, 66 },
|
||||
{-115, 68 }, { -68, 69 }, { -56, -69 }, { -4,-100 }, {-151, 70 },
|
||||
{-135, 71 }, {-103,-119 }, { 73, 72 }, { -71,-145 }, {-102, 74 },
|
||||
{ 76, 75 }, { -53, -85 }, { -37, 77 }, { -21, -86 }, { 79, 78 },
|
||||
{ -5, 80 }, { -54,-134 }, {-150, 81 }, {-118, 82 }, { -70, 83 },
|
||||
{-117, 84 }, { -22, -38 }, {-101, 85 }, { -55, 86 }, {-149, 87 },
|
||||
{ -39, 88 }, {-133, 89 }, { -6, 90 }, {-116, 91 }, { -24, 92 },
|
||||
{ -7,-132 }, { -23, 93 }, { -40, 94 }, {-131,-148 }, { -25, 95 },
|
||||
{-147, 96 }, {-146, 97 }, { -8, 0 }, { 0, 0 }, },
|
||||
{ { 2, 1 }, { 4, 3 }, { 6, 5 }, {-154, 7 }, { 9, 8 },
|
||||
{ 11, 10 }, { 13, 12 }, { 15, 14 }, { -18, 16 }, {-153, 17 },
|
||||
{ -1, -2 }, { 19, 18 }, {-138, 20 }, { -17, 21 }, { 23, 22 },
|
||||
{ 25, 24 }, { -19,-137 }, { 27, 26 }, {-152, 28 }, { 30, 29 },
|
||||
{ -3, -34 }, { 32, 31 }, { 34, 33 }, { 36, 35 }, {-136, 37 },
|
||||
{ -35, 38 }, { -20, 39 }, {-122, 40 }, {-151, 41 }, { -33, 42 },
|
||||
{-121, 43 }, { 45, 44 }, { 47, 46 }, { -4, 48 }, { -36,-120 },
|
||||
{-135, 49 }, { 51, 50 }, { -21, 52 }, { 54, 53 }, { 56, 55 },
|
||||
{ -50,-150 }, { 58, 57 }, { -51, 59 }, { 61, 60 }, {-119, 62 },
|
||||
{ -52, 63 }, { -5, 64 }, { -37, 65 }, {-117,-134 }, { -39, -54 },
|
||||
{ -22, 66 }, {-106, 67 }, { -69,-102 }, {-132, 68 }, {-105, 69 },
|
||||
{ -49, 70 }, {-149, 71 }, { -24,-104 }, { 73, 72 }, { -53, 74 },
|
||||
{ -38,-118 }, {-103, 75 }, { -6, 76 }, { -66, -87 }, {-133,-147 },
|
||||
{ -23, 77 }, { -67, 78 }, { -68, -86 }, { -70,-101 }, { -40,-148 },
|
||||
{-116, 79 }, { -55, 80 }, { -84,-131 }, { 82, 81 }, { -89, -90 },
|
||||
{ -7, -25 }, { -85, -88 }, { -65, 83 }, { -72,-146 }, { 85, 84 },
|
||||
{ -9, -71 }, { -83, 86 }, { -82, 87 }, { -8, 88 }, {-100, 89 },
|
||||
{ -74, -99 }, { -73, 90 }, { -10, -81 }, { -56, 91 }, { -57, -98 },
|
||||
{ 93, 92 }, { -58,-114 }, { -97,-115 }, { 95, 94 }, { -41, 96 },
|
||||
{ -42, 97 }, { -26,-129 }, {-113, 98 }, {-130,-145 }, },
|
||||
},
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod_firstband_ICC[7][2] = {
|
||||
{ 2, 1 }, { -5, 3 }, { -4, -6 }, { -3, 4 }, { -2, 5 },
|
||||
{ -1, 6 }, { -7, -8 },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod1D_ICC[7][2] = {
|
||||
{ -1, 1 }, { -2, 2 }, { -3, 3 }, { -4, 4 }, { -5, 5 },
|
||||
{ -6, 6 }, { -7, -8 },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_ICC_01[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][3][2] = {
|
||||
{ { { -1, 1 }, { -18, 2 }, { -2, -17 }, },
|
||||
{ { -1, 1 }, { -18, 2 }, { -2, -17 }, }, },
|
||||
{ { { -1, 1 }, { -18, 2 }, { -2, -17 }, },
|
||||
{ { -1, 1 }, { -18, 2 }, { -2, -17 }, }, },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_ICC_03[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][15][2] = {
|
||||
{ { { -52, 1 }, { -1, 2 }, { 4, 3 }, { -2, 5 }, { -17, -18 },
|
||||
{ -51, 6 }, { -36, 7 }, { 9, 8 }, { -35, 10 }, { -3, 11 },
|
||||
{ -19, -34 }, { -33, 12 }, { -50, 13 }, { -20, 14 }, { -4, -49 }, },
|
||||
{ { 2, 1 }, { -1, -52 }, { -17, 3 }, { 5, 4 }, { -36, 6 },
|
||||
{ -2, 7 }, { -18, -33 }, { 9, 8 }, { -20, 10 }, { -34, -51 },
|
||||
{ -49, 11 }, { -35, 12 }, { -19, 13 }, { -3, 14 }, { -4, -50 }, }, },
|
||||
{ { { -52, 1 }, { -1, 2 }, { 4, 3 }, { -2, -17 }, { -18, 5 },
|
||||
{ -36, 6 }, { -51, 7 }, { 9, 8 }, { -33, 10 }, { -34, 11 },
|
||||
{ -35, 12 }, { -19, -20 }, { -3, 13 }, { -49, 14 }, { -4, -50 }, },
|
||||
{ { 2, 1 }, { -1, -52 }, { -2, 3 }, { 5, 4 }, { -51, 6 },
|
||||
{ -18, 7 }, { -17, 8 }, { -3, 9 }, { -36, 10 }, { -19, -50 },
|
||||
{ -35, 11 }, { -4, 12 }, { -34, 13 }, { -33, 14 }, { -20, -49 }, },},
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_ICC_05[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][35][2] = {
|
||||
{ { { 2, 1 }, { -86, 3 }, { -1, 4 }, { 6, 5 }, { -18, 7 },
|
||||
{ -2, -17 }, { 9, 8 }, { -70, 10 }, { -69, -85 }, { -35, 11 },
|
||||
{ 13, 12 }, { -34, 14 }, { -19, 15 }, { -53, 16 }, { -68, 17 },
|
||||
{ -33, 18 }, { -3, -52 }, { 20, 19 }, { -54, 21 }, { -84, 22 },
|
||||
{ -50, 23 }, { -20, -51 }, { -36, 24 }, { 26, 25 }, { -83, 27 },
|
||||
{ -4, -38 }, { -49, 28 }, { -37, 29 }, { -67, 30 }, { -5, 31 },
|
||||
{ -21, 32 }, { -65, -66 }, { -82, 33 }, { -22, 34 }, { -6, -81 }, },
|
||||
{ { 2, 1 }, { -86, 3 }, { -1, 4 }, { -17, 5 }, { 7, 6 },
|
||||
{ -70, 8 }, { -33, 9 }, { -18, 10 }, { -2, 11 }, { -54, 12 },
|
||||
{ -49, 13 }, { -38, 14 }, { -34, -65 }, { -85, 15 }, { -50, 16 },
|
||||
{ -69, 17 }, { -22, 18 }, { -53, 19 }, { 21, 20 }, { -19, -81 },
|
||||
{ -66, 22 }, { -3, -35 }, { 24, 23 }, { -37, 25 }, { -68, -84 },
|
||||
{ -51, 26 }, { 28, 27 }, { -20, -52 }, { 30, 29 }, { -4, -36 },
|
||||
{ -83, 31 }, { -67, 32 }, { -82, 33 }, { -21, 34 }, { -5, -6 }, }, },
|
||||
{ { { -1, 1 }, { -86, 2 }, { 4, 3 }, { -17, 5 }, { -2, 6 },
|
||||
{ -18, 7 }, { -70, 8 }, { -85, 9 }, { 11, 10 }, { 13, 12 },
|
||||
{ -33, 14 }, { 16, 15 }, { -34, -54 }, { -69, 17 }, { -38, 18 },
|
||||
{ -50, 19 }, { -35, -53 }, { -49, 20 }, { -19, 21 }, { -3, 22 },
|
||||
{ -65, 23 }, { -68, 24 }, { -22, 25 }, { -81, -84 }, { -66, 26 },
|
||||
{ -37, 27 }, { -20, -51 }, { 29, 28 }, { -52, 30 }, { -4, -83 },
|
||||
{ -36, 31 }, { -67, 32 }, { -5, 33 }, { -82, 34 }, { -21, 0 }, },
|
||||
{ { 2, 1 }, { -86, 3 }, { -1, 4 }, { 6, 5 }, { -2, 7 },
|
||||
{ -85, 8 }, { -18, 9 }, { 11, 10 }, { -17, 12 }, { 14, 13 },
|
||||
{ -70, 15 }, { -3, -19 }, { -69, 16 }, { -84, 17 }, { -68, 18 },
|
||||
{ -20, -35 }, { -34, -83 }, { 20, 19 }, { -4, 21 }, { -33, 22 },
|
||||
{ -5, 23 }, { -53, 24 }, { -36, -52 }, { -67, 25 }, { -21, -82 },
|
||||
{ -54, 26 }, { -6, 27 }, { -51, 28 }, { -50, 29 }, { -49, 30 },
|
||||
{ -37, 31 }, { -38, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, }, },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_ICC_07[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][63][2] = {
|
||||
{ { { 2, 1 }, { -1,-120 }, { 4, 3 }, { 6, 5 }, { -18, 7 },
|
||||
{ 9, 8 }, { -17, 10 }, { -2, 11 }, {-103, 12 }, { -52, 13 },
|
||||
{ -35,-104 }, {-119, 14 }, { 16, 15 }, { -69, -86 }, { 18, 17 },
|
||||
{ -34, 19 }, { -19, 20 }, { 22, 21 }, { -70, 23 }, { -87, 24 },
|
||||
{-102, 25 }, { -85, 26 }, { -33, 27 }, { -36, 28 }, { -3, 29 },
|
||||
{ -88, 30 }, { -51, 31 }, {-118, 32 }, { 34, 33 }, { -68, 35 },
|
||||
{ -53, 36 }, { -67, 37 }, { -20, 38 }, {-101, 39 }, { -50, 40 },
|
||||
{ 42, 41 }, { -37, 43 }, {-116, 44 }, {-117, 45 }, { -49, 46 },
|
||||
{ -21,-100 }, { 48, 47 }, { -55, -71 }, { -4, 49 }, { -22, -84 },
|
||||
{-115, 50 }, { -66, -82 }, { -72, 51 }, { -5, -6 }, { -54, 52 },
|
||||
{ -38, 53 }, { -83, 54 }, { -40, 55 }, { -39, 56 }, { -99, 57 },
|
||||
{ -23, -56 }, { -7, 58 }, { -65, -97 }, { -8, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, },
|
||||
{ { 2, 1 }, { 4, 3 }, { -1,-120 }, { 6, 5 }, { 8, 7 },
|
||||
{ -18, 9 }, { -2, 10 }, { 12, 11 }, { 14, 13 }, { -17,-119 },
|
||||
{ 16, 15 }, {-103, 17 }, {-104, 18 }, { -52, 19 }, { 21, 20 },
|
||||
{ -69, 22 }, { 24, 23 }, { -3, -35 }, { -19, 25 }, { -34, -85 },
|
||||
{ 27, 26 }, { -86, 28 }, {-118, 29 }, { -37, 30 }, { 32, 31 },
|
||||
{-102, 33 }, { -20, -22 }, { -4,-117 }, { -87, 34 }, {-100, 35 },
|
||||
{ -33, -36 }, { 37, 36 }, { -70, -88 }, {-101, 38 }, { -5, 39 },
|
||||
{ -51, -53 }, { -50, 40 }, {-115, 41 }, { -21, 42 }, {-116, 43 },
|
||||
{ -38, 44 }, { -23, -84 }, { -49, -99 }, { 46, 45 }, { -6,-114 },
|
||||
{ -7, -72 }, { -71, 47 }, { -8, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, }, },
|
||||
{ { { -1, 1 }, {-120, 2 }, { 4, 3 }, { -17, 5 }, { -2, 6 },
|
||||
{ 8, 7 }, { -18, 9 }, {-104, 10 }, { 12, 11 }, { 14, 13 },
|
||||
{ 16, 15 }, {-119, 17 }, { -81, 18 }, { 20, 19 }, { -33, 21 },
|
||||
{ -88, 22 }, {-103, 23 }, { -34, 24 }, { -56, 25 }, { -72, 26 },
|
||||
{ -49, 27 }, { -82, 28 }, { -50, 29 }, { -65, 30 }, { -55, -87 },
|
||||
{ -19, 31 }, { -67, 32 }, { -35, -40 }, { 34, 33 }, { -52, -71 },
|
||||
{ -66, 35 }, { -70, 36 }, { 38, 37 }, { -51, -97 }, { -86,-102 },
|
||||
{ -3, 39 }, {-118, 40 }, { 42, 41 }, { -24, -85 }, { -54, 43 },
|
||||
{ -39, 44 }, { -98,-113 }, { -36, -37 }, { -20, -69 }, { -4, 45 },
|
||||
{ -5, 46 }, { -21, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, },
|
||||
{ { 2, 1 }, { 4, 3 }, { -1,-120 }, { 6, 5 }, { 8, 7 },
|
||||
{ -18, 9 }, { -2, 10 }, { 12, 11 }, { 14, 13 }, { -17,-119 },
|
||||
{ 16, 15 }, {-103, 17 }, {-104, 18 }, { -52, 19 }, { 21, 20 },
|
||||
{ -69, 22 }, { 24, 23 }, { -3, -35 }, { -19, 25 }, { -34, -85 },
|
||||
{ 27, 26 }, { -86, 28 }, {-118, 29 }, { -37, 30 }, { 32, 31 },
|
||||
{-102, 33 }, { -20, -22 }, { -4,-117 }, { -87, 34 }, {-100, 35 },
|
||||
{ -33, -36 }, { 37, 36 }, { -70, -88 }, {-101, 38 }, { -5, 39 },
|
||||
{ -51, -53 }, { -50, 40 }, {-115, 41 }, { -21, 42 }, {-116, 43 },
|
||||
{ -38, 44 }, { -23, -84 }, { -49, -99 }, { 46, 45 }, { -6,-114 },
|
||||
{ -7, -72 }, { -71, 47 }, { -8, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, }, },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod_firstband_IPD[7][2] = {
|
||||
{ -1, 1 }, { -8, 2 }, { -2, 3 }, { 5, 4 }, { -7, 6 },
|
||||
{ -3, -5 }, { -4, -6 },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod1D_IPD[2 /* DT, DF */ ][7][2] = {
|
||||
{ { -1, 1 }, { -2, 2 }, { -8, 3 }, { -3, 4 }, { -7, 5 },
|
||||
{ -4, 6 }, { -5, -6 }, }, /* DT */
|
||||
{ { -1, 1 }, { -8, 2 }, { -2, 3 }, { 5, 4 }, { -3, -7 },
|
||||
{ -6, 6 }, { -4, -5 }, }, /* DF */
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_IPD_01[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][3][2] = {
|
||||
{ { { -1, 1 }, { -18, 2 }, { -17, 0 }, },
|
||||
{ { -1, 1 }, { -18, 2 }, { -17, 0 }, }, },
|
||||
{ { { -1, 1 }, { -18, 2 }, { -17, 0 }, },
|
||||
{ { -1, 1 }, { -18, 2 }, { -17, 0 }, }, },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_IPD_03[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][15][2] = {
|
||||
{ { { -1, 1 }, { 3, 2 }, { -18, 4 }, { -52, 5 }, { -34, -36 },
|
||||
{ -35, 6 }, { -17, 7 }, { -33, 8 }, { -20, 9 }, { -49, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, },
|
||||
{ { -1, 1 }, { -36, 2 }, { -18, 3 }, { -35, 4 }, { -52, 5 },
|
||||
{ 7, 6 }, { -34, 8 }, { -33, -49 }, { -20, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, }, },
|
||||
{ { { -1, 1 }, { 3, 2 }, { -18, 4 }, { -52, 5 }, { -34, -36 },
|
||||
{ -35, 6 }, { -17, 7 }, { -33, 8 }, { -20, 9 }, { -49, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, },
|
||||
{ { -1, 1 }, { -36, 2 }, { -18, 3 }, { -35, 4 }, { -52, 5 },
|
||||
{ 7, 6 }, { -34, 8 }, { -33, -49 }, { -20, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, }, },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_IPD_05[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][35][2] = {
|
||||
{ { { -1, 1 }, { 3, 2 }, { -52, 4 }, { -86, 5 }, { -35, 6 },
|
||||
{ -53, 7 }, { -70, 8 }, { -17, 9 }, { -37, 10 }, { 12, 11 },
|
||||
{ -38, -66 }, { -18, 13 }, { -51, 14 }, { 16, 15 }, { -34, -69 },
|
||||
{ 18, 17 }, { -54, -65 }, { -50, 19 }, { -33, -49 }, { -22, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, },
|
||||
{ { -1, 1 }, { 3, 2 }, { 5, 4 }, { -86, 6 }, { -66, 7 },
|
||||
{ 9, 8 }, { 11, 10 }, { -18, 12 }, { -51, 13 }, { -37, -52 },
|
||||
{ -69, 14 }, { -38, 15 }, { -53, 16 }, { -35, 17 }, { -50, -70 },
|
||||
{ -22, -49 }, { -33, 18 }, { -17, 19 }, { -34, -65 }, { -81, 20 },
|
||||
{ -54, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, }, },
|
||||
{ { { -1, 1 }, { 3, 2 }, { -52, 4 }, { -86, 5 }, { -35, 6 },
|
||||
{ -53, 7 }, { -70, 8 }, { -17, 9 }, { -37, 10 }, { 12, 11 },
|
||||
{ -38, -66 }, { -18, 13 }, { -51, 14 }, { 16, 15 }, { -34, -69 },
|
||||
{ 18, 17 }, { -54, -65 }, { -50, 19 }, { -33, -49 }, { -22, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, },
|
||||
{ { -1, 1 }, { 3, 2 }, { 5, 4 }, { -86, 6 }, { -66, 7 },
|
||||
{ 9, 8 }, { 11, 10 }, { -18, 12 }, { -51, 13 }, { -37, -52 },
|
||||
{ -69, 14 }, { -38, 15 }, { -53, 16 }, { -35, 17 }, { -50, -70 },
|
||||
{ -22, -49 }, { -33, 18 }, { -17, 19 }, { -34, -65 }, { -81, 20 },
|
||||
{ -54, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, }, },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_IPD_07[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][63][2] = {
|
||||
{ { { -1, 1 }, { -69, 2 }, { 4, 3 }, {-120, 5 }, { 7, 6 },
|
||||
{-113, 8 }, { -68, 9 }, { 11, 10 }, { -17, 12 }, { -52, 13 },
|
||||
{ -24, 14 }, { -18, 15 }, { 17, 16 }, {-104, 18 }, { 20, 19 },
|
||||
{ -54, -70 }, { 22, 21 }, { 24, 23 }, { -86, -97 }, {-103, 25 },
|
||||
{ -83, 26 }, { -35, 27 }, { -34, -98 }, { -40, 28 }, { -39, -67 },
|
||||
{ 30, 29 }, { -33, -51 }, { -87, 31 }, { -88, 32 }, { -82, 33 },
|
||||
{ -55, -81 }, { -56, -71 }, { -72, 34 }, { -50, -66 }, { -65, 35 },
|
||||
{ -49, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, },
|
||||
{ { 2, 1 }, { 4, 3 }, { -1, 5 }, { -69, 6 }, {-120, 7 },
|
||||
{ -68, 8 }, { 10, 9 }, { 12, 11 }, { 14, 13 }, { -52, -54 },
|
||||
{ -18, 15 }, { -70, 16 }, { -67, 17 }, { 19, 18 }, { -17, 20 },
|
||||
{-113, 21 }, { 23, 22 }, { -83, 24 }, { -24, 25 }, {-103,-104 },
|
||||
{ -51, -55 }, { 27, 26 }, { -71, 28 }, { -86, 29 }, { -35, 30 },
|
||||
{ -66, 31 }, { -39, -50 }, { -82, -98 }, { -72, 32 }, { -56, -87 },
|
||||
{ -34, 33 }, { -33, -88 }, { -40, -97 }, { -65, 34 }, { -49, 35 },
|
||||
{ -81, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, }, },
|
||||
{ { { -1, 1 }, { -69, 2 }, { 4, 3 }, {-120, 5 }, { 7, 6 },
|
||||
{-113, 8 }, { -68, 9 }, { 11, 10 }, { -17, 12 }, { -52, 13 },
|
||||
{ -24, 14 }, { -18, 15 }, { 17, 16 }, {-104, 18 }, { 20, 19 },
|
||||
{ -54, -70 }, { 22, 21 }, { 24, 23 }, { -86, -97 }, {-103, 25 },
|
||||
{ -83, 26 }, { -35, 27 }, { -34, -98 }, { -40, 28 }, { -39, -67 },
|
||||
{ 30, 29 }, { -33, -51 }, { -87, 31 }, { -88, 32 }, { -82, 33 },
|
||||
{ -55, -81 }, { -56, -71 }, { -72, 34 }, { -50, -66 }, { -65, 35 },
|
||||
{ -49, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, },
|
||||
{ { 2, 1 }, { 4, 3 }, { -1, 5 }, { -69, 6 }, {-120, 7 },
|
||||
{ -68, 8 }, { 10, 9 }, { 12, 11 }, { 14, 13 }, { -52, -54 },
|
||||
{ -18, 15 }, { -70, 16 }, { -67, 17 }, { 19, 18 }, { -17, 20 },
|
||||
{-113, 21 }, { 23, 22 }, { -83, 24 }, { -24, 25 }, {-103,-104 },
|
||||
{ -51, -55 }, { 27, 26 }, { -71, 28 }, { -86, 29 }, { -35, 30 },
|
||||
{ -66, 31 }, { -39, -50 }, { -82, -98 }, { -72, 32 }, { -56, -87 },
|
||||
{ -34, 33 }, { -33, -88 }, { -40, -97 }, { -65, 34 }, { -49, 35 },
|
||||
{ -81, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
|
||||
{ 0, 0 }, { 0, 0 }, { 0, 0 }, }, },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod_lav_idx[3][2] = {
|
||||
{ -1, 1 }, { -2, 2 }, { -3, -4 },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_hcod2D_reshape[39][2] = {
|
||||
{ 2, 1 }, { 4, 3 }, { 6, 5 }, { -33, 7 }, { -17, 8 },
|
||||
{ -49, 9 }, { -34, 10 }, { 12, 11 }, { -18, -35 }, { -50, 13 },
|
||||
{ 15, 14 }, { -40, 16 }, { -36, 17 }, { -19, 18 }, { -1, -37 },
|
||||
{ -51, 19 }, { 21, 20 }, { -38, -65 }, { -2, -39 }, { -20, 22 },
|
||||
{ -52, 23 }, { 25, 24 }, { -21, 26 }, { -66, 27 }, { -53, 28 },
|
||||
{ -3, 29 }, { 31, 30 }, { -22, 32 }, { -54, 33 }, { -4, 34 },
|
||||
{ -56, 35 }, { -24, -67 }, { -23, -55 }, { -8, -72 }, { -5, 36 },
|
||||
{ -68, 37 }, { -6, 38 }, { -7, -69 }, { -70, -71 },
|
||||
};
|
||||
|
||||
const uint8_t ff_aac_lav_tab_XXX[3][4] = {
|
||||
{ 3, 5, 7, 9 }, { 1, 3, 5, 7 }, { 7, 1, 3, 5 }
|
||||
};
|
||||
|
||||
static av_cold void init_base_tables(void)
|
||||
{
|
||||
static VLCElem vlc_buf[(304 + 270 + 550 + 300 + 328 +
|
||||
294 + 306 + 268 + 510 + 366 + 462)];
|
||||
VLCInitState state = VLC_INIT_STATE(vlc_buf);
|
||||
|
||||
for (unsigned i = 0; i < 11; i++) {
|
||||
#define TAB_WRAP_SIZE(name) name[i], sizeof(name[i][0]), sizeof(name[i][0])
|
||||
ff_vlc_spectral[i] =
|
||||
@@ -769,12 +287,17 @@ static av_cold void init_base_tables(void)
|
||||
ff_aac_scalefactor_code,
|
||||
sizeof(ff_aac_scalefactor_code[0]),
|
||||
sizeof(ff_aac_scalefactor_code[0]), 0);
|
||||
}
|
||||
|
||||
static av_cold void aacdec_common_init(void)
|
||||
{
|
||||
init_base_tables();
|
||||
init_sbr_tables();
|
||||
// SBR VLC table initialization
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(ff_aac_sbr_vlc); i++) {
|
||||
ff_aac_sbr_vlc[i] =
|
||||
ff_vlc_init_tables_from_lengths(&state, 9, sbr_huffman_nb_codes[i],
|
||||
&tab[0][1], 2,
|
||||
&tab[0][0], 2, 1,
|
||||
sbr_vlc_offsets[i], 0);
|
||||
tab += sbr_huffman_nb_codes[i];
|
||||
}
|
||||
|
||||
ff_ps_init_common();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,33 +50,6 @@ extern const uint8_t ff_aac_channel_layout_map[16][16][3];
|
||||
extern const int16_t ff_aac_channel_map[3][4][6];
|
||||
|
||||
extern const AVChannelLayout ff_aac_ch_layout[];
|
||||
|
||||
extern const int16_t ff_aac_hcod_firstband_CLD[30][2];
|
||||
extern const int16_t ff_aac_hcod1D_CLD[2 /* DT_/DF_ */][30][2];
|
||||
extern const int16_t ff_aac_hcod2D_CLD_03[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][15][2];
|
||||
extern const int16_t ff_aac_hcod2D_CLD_05[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][35][2];
|
||||
extern const int16_t ff_aac_hcod2D_CLD_07[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][63][2];
|
||||
extern const int16_t ff_aac_hcod2D_CLD_09[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][99][2];
|
||||
|
||||
extern const int16_t ff_aac_hcod_firstband_ICC[7][2];
|
||||
extern const int16_t ff_aac_hcod1D_ICC[7][2];
|
||||
extern const int16_t ff_aac_hcod2D_ICC_01[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][3][2];
|
||||
extern const int16_t ff_aac_hcod2D_ICC_03[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][15][2];
|
||||
extern const int16_t ff_aac_hcod2D_ICC_05[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][35][2];
|
||||
extern const int16_t ff_aac_hcod2D_ICC_07[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][63][2];
|
||||
|
||||
extern const int16_t ff_aac_hcod_firstband_IPD[7][2];
|
||||
extern const int16_t ff_aac_hcod1D_IPD[2 /* DF, DT */ ][7][2];
|
||||
extern const int16_t ff_aac_hcod2D_IPD_01[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][3][2];
|
||||
extern const int16_t ff_aac_hcod2D_IPD_03[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][15][2];
|
||||
extern const int16_t ff_aac_hcod2D_IPD_05[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][35][2];
|
||||
extern const int16_t ff_aac_hcod2D_IPD_07[2 /* _TP/_FP */ ][2 /* DT_/DF_ */ ][63][2];
|
||||
|
||||
extern const int16_t ff_aac_hcod_lav_idx[3][2];
|
||||
|
||||
extern const int16_t ff_aac_hcod2D_reshape[39][2];
|
||||
|
||||
extern const uint8_t ff_aac_lav_tab_XXX[3][4];
|
||||
FF_VISIBILITY_POP_HIDDEN
|
||||
|
||||
#endif /* AVCODEC_AAC_AACDEC_TAB_H */
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/refstruct.h"
|
||||
|
||||
#include "aacdec_usac_mps212.h"
|
||||
|
||||
/* Number of scalefactor bands per complex prediction band, equal to 2. */
|
||||
#define SFB_PER_PRED_BAND 2
|
||||
|
||||
@@ -221,15 +219,12 @@ static int decode_usac_element_pair(AACDecContext *ac,
|
||||
e->mps.high_rate_mode = get_bits1(gb); /* bsHighRateMode */
|
||||
e->mps.phase_coding = get_bits1(gb); /* bsPhaseCoding */
|
||||
|
||||
e->mps.otts_bands_phase_present = get_bits1(gb);
|
||||
if (e->mps.otts_bands_phase_present) /* bsOttBandsPhasePresent */
|
||||
if (get_bits1(gb)) /* bsOttBandsPhasePresent */
|
||||
e->mps.otts_bands_phase = get_bits(gb, 5); /* bsOttBandsPhase */
|
||||
|
||||
e->mps.residual_coding = e->stereo_config_index >= 2; /* bsResidualCoding */
|
||||
if (e->mps.residual_coding) {
|
||||
e->mps.residual_bands = get_bits(gb, 5); /* bsResidualBands */
|
||||
e->mps.otts_bands_phase = FFMAX(e->mps.otts_bands_phase,
|
||||
e->mps.residual_bands);
|
||||
e->mps.pseudo_lr = get_bits1(gb); /* bsPseudoLr */
|
||||
}
|
||||
if (e->mps.temp_shape_config == 2)
|
||||
@@ -320,7 +315,7 @@ int ff_aac_usac_reset_state(AACDecContext *ac, OutputConfiguration *oc)
|
||||
ff_aac_sbr_config_usac(ac, che, e);
|
||||
|
||||
for (int j = 0; j < ch; j++) {
|
||||
SingleChannelElement *sce = &che->ch[j];
|
||||
SingleChannelElement *sce = &che->ch[ch];
|
||||
AACUsacElemData *ue = &sce->ue;
|
||||
|
||||
memset(ue, 0, sizeof(*ue));
|
||||
@@ -1348,164 +1343,6 @@ static void spectrum_decode(AACDecContext *ac, AACUSACConfig *usac,
|
||||
}
|
||||
}
|
||||
|
||||
static const uint8_t mps_fr_nb_bands[8] = {
|
||||
255 /* Reserved */, 28, 20, 14, 10, 7, 5, 4,
|
||||
};
|
||||
|
||||
static const uint8_t mps_fr_stride_smg[4] = {
|
||||
1, 2, 5, 28,
|
||||
};
|
||||
|
||||
static void decode_tsd(GetBitContext *gb, int *data,
|
||||
int nb_tr_slots, int nb_slots)
|
||||
{
|
||||
int nb_bits = av_log2(nb_slots / (nb_tr_slots + 1));
|
||||
int s = get_bits(gb, nb_bits);
|
||||
for (int k = 0; k < nb_slots; k++)
|
||||
data[k]=0;
|
||||
|
||||
int p = nb_tr_slots + 1;
|
||||
for (int k = nb_slots - 1; k >= 0; k--) {
|
||||
if (p > k) {
|
||||
for (; k >= 0; k--)
|
||||
data[k] = 1;
|
||||
break;
|
||||
}
|
||||
int64_t c = k - p + 1;
|
||||
for (int h = 2; h <= p; h++) {
|
||||
c *= k - p + h;
|
||||
c /= h;
|
||||
}
|
||||
if (s >= (int)c) { /* c is long long for up to 32 slots */
|
||||
s -= c;
|
||||
data[k] = 1;
|
||||
p--;
|
||||
if (!p)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int parse_mps212(AACDecContext *ac, AACUSACConfig *usac,
|
||||
AACUsacMPSData *mps, AACUsacElemConfig *ec,
|
||||
GetBitContext *gb, int frame_indep_flag)
|
||||
{
|
||||
int err;
|
||||
int nb_bands = mps_fr_nb_bands[ec->mps.freq_res];
|
||||
|
||||
/* Framing info */
|
||||
mps->framing_type = 0;
|
||||
mps->nb_param_sets = 2;
|
||||
if (ec->mps.high_rate_mode) {
|
||||
mps->framing_type = get_bits1(gb);
|
||||
mps->nb_param_sets = get_bits(gb, 3) + 1;
|
||||
}
|
||||
int param_slot_bits = usac->core_sbr_frame_len_idx == 4 ? 6 : 5;
|
||||
int nb_time_slots = usac->core_sbr_frame_len_idx == 4 ? 64 : 32;
|
||||
|
||||
if (mps->framing_type)
|
||||
for (int i = 0; i < mps->nb_param_sets; i++)
|
||||
mps->param_sets[i] = get_bits(gb, param_slot_bits);
|
||||
|
||||
int indep = frame_indep_flag;
|
||||
if (!frame_indep_flag)
|
||||
indep = get_bits1(gb);
|
||||
|
||||
int extend_frame = mps->param_sets[mps->nb_param_sets - 1] !=
|
||||
(nb_time_slots - 1);
|
||||
|
||||
/* CLD */
|
||||
err = ff_aac_ec_data_dec(gb, &mps->ott[MPS_CLD], MPS_CLD,
|
||||
0, 0, nb_bands,
|
||||
indep, indep, mps->nb_param_sets);
|
||||
if (err < 0) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "Error parsing OTT CLD data!\n");
|
||||
return err;
|
||||
}
|
||||
ff_aac_map_index_data(&mps->ott[MPS_CLD], MPS_CLD, mps->ott_idx[MPS_CLD],
|
||||
0, 0, nb_bands, mps->nb_param_sets,
|
||||
mps->param_sets, extend_frame);
|
||||
|
||||
/* ICC */
|
||||
err = ff_aac_ec_data_dec(gb, &mps->ott[MPS_ICC], MPS_ICC, 0, 0, nb_bands,
|
||||
indep, indep, mps->nb_param_sets);
|
||||
if (err < 0) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "Error parsing OTT ICC data!\n");
|
||||
return err;
|
||||
}
|
||||
ff_aac_map_index_data(&mps->ott[MPS_ICC], MPS_ICC, mps->ott_idx[MPS_ICC],
|
||||
0, 0, nb_bands, mps->nb_param_sets,
|
||||
mps->param_sets, extend_frame);
|
||||
|
||||
/* IPD */
|
||||
if (ec->mps.phase_coding) {
|
||||
if (get_bits1(gb)) {
|
||||
mps->opd_smoothing_mode = get_bits1(gb);
|
||||
err = ff_aac_ec_data_dec(gb, &mps->ott[MPS_IPD], MPS_IPD, 0, 0,
|
||||
ec->mps.otts_bands_phase,
|
||||
indep, indep, mps->nb_param_sets);
|
||||
ff_aac_map_index_data(&mps->ott[MPS_IPD], MPS_IPD, mps->ott_idx[MPS_IPD],
|
||||
0, 0, nb_bands, mps->nb_param_sets,
|
||||
mps->param_sets, extend_frame);
|
||||
if (err < 0) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "Error parsing OTT IPD data!\n");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* SMG data */
|
||||
memset(mps->smooth_mode, 0, sizeof(mps->smooth_mode));
|
||||
if (ec->mps.high_rate_mode) {
|
||||
for (int i = 0; i < mps->nb_param_sets; i++) {
|
||||
mps->smooth_mode[i] = get_bits(gb, 2);
|
||||
if (mps->smooth_mode[i] >= 2)
|
||||
mps->smooth_time[i] = get_bits(gb, 2);
|
||||
if (mps->smooth_mode[i] >= 3) {
|
||||
mps->freq_res_stride_smg[i] = get_bits(gb, 2);
|
||||
int nb_data_bands = (nb_bands - 1);
|
||||
nb_data_bands /= (mps_fr_stride_smg[mps->freq_res_stride_smg[i]] + 1);
|
||||
for (int j = 0; j < nb_data_bands; j++)
|
||||
mps->smg_data[i][j] = get_bits1(gb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Temp shape data */
|
||||
mps->tsd_enable = 0;
|
||||
if (ec->mps.temp_shape_config == 3) {
|
||||
mps->tsd_enable = get_bits1(gb);
|
||||
} else if (ec->mps.temp_shape_config) {
|
||||
mps->temp_shape_enable = get_bits1(gb);
|
||||
if (mps->temp_shape_enable) {
|
||||
for (int i = 0; i < 2; i++)
|
||||
mps->temp_shape_enable_ch[i] = get_bits1(gb);
|
||||
if (ec->mps.temp_shape_config == 2) {
|
||||
err = ff_aac_huff_dec_reshape(gb, mps->temp_shape_data, 16);
|
||||
if (err < 0) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Error parsing TSD reshape data!\n");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* TSD data */
|
||||
if (mps->tsd_enable) {
|
||||
mps->tsd_num_tr_slots = get_bits(gb, param_slot_bits - 1);
|
||||
int tsd_pos[64];
|
||||
decode_tsd(gb, tsd_pos, mps->tsd_num_tr_slots, nb_time_slots);
|
||||
for (int i = 0; i < nb_time_slots; i++) {
|
||||
mps->tsd_phase_data[i] = 0;
|
||||
if (tsd_pos[i])
|
||||
mps->tsd_phase_data[i] = get_bits(gb, 3);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_usac_core_coder(AACDecContext *ac, AACUSACConfig *usac,
|
||||
AACUsacElemConfig *ec, ChannelElement *che,
|
||||
GetBitContext *gb, int indep_flag, int nb_channels)
|
||||
@@ -1627,8 +1464,7 @@ static int decode_usac_core_coder(AACDecContext *ac, AACUSACConfig *usac,
|
||||
if (get_bits1(gb)) { /* fac_data_present */
|
||||
const uint16_t len_8 = usac->core_frame_len / 8;
|
||||
const uint16_t len_16 = usac->core_frame_len / 16;
|
||||
const uint16_t fac_len = ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE ?
|
||||
len_16 : len_8;
|
||||
const uint16_t fac_len = ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE ? len_16 : len_8;
|
||||
ret = ff_aac_parse_fac_data(ue, gb, 1, fac_len);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -1647,9 +1483,8 @@ static int decode_usac_core_coder(AACDecContext *ac, AACUSACConfig *usac,
|
||||
}
|
||||
|
||||
if (ec->stereo_config_index) {
|
||||
ret = parse_mps212(ac, usac, &us->mps, ec, gb, indep_flag);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
avpriv_report_missing_feature(ac->avctx, "AAC USAC Mps212");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
spectrum_decode(ac, usac, che, core_nb_channels);
|
||||
|
||||
@@ -1,919 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2025 Lynne <dev@lynne.ee>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it 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 "aacdec_tab.h"
|
||||
#include "libavcodec/get_bits.h"
|
||||
#include "libavutil/macros.h"
|
||||
#include "libavutil/avassert.h"
|
||||
|
||||
#include "aacdec_usac_mps212.h"
|
||||
|
||||
static int huff_dec_1D(GetBitContext *gb, const int16_t (*tab)[2])
|
||||
{
|
||||
int idx = 0;
|
||||
do {
|
||||
/* Overreads are not possible here, the array forms a closed set */
|
||||
idx = tab[idx][get_bits1(gb)];
|
||||
} while (idx > 0);
|
||||
return idx;
|
||||
}
|
||||
|
||||
static int huff_dec_2D(GetBitContext *gb, const int16_t (*tab)[2], int16_t ret[2])
|
||||
{
|
||||
int idx = huff_dec_1D(gb, tab);
|
||||
if (!idx) { /* Escape */
|
||||
ret[0] = 0;
|
||||
ret[1] = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
idx = -(idx + 1);
|
||||
ret[0] = idx >> 4;
|
||||
ret[1] = idx & 0xf;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int huff_data_1d(GetBitContext *gb, int16_t *data, int data_bands,
|
||||
enum AACMPSDataType data_type, int diff_freq, int p0_flag)
|
||||
{
|
||||
const int16_t (*hcod_first_band)[2];
|
||||
const int16_t (*hcod1D)[2];
|
||||
|
||||
switch (data_type) {
|
||||
case MPS_CLD:
|
||||
hcod_first_band = ff_aac_hcod_firstband_CLD;
|
||||
hcod1D = ff_aac_hcod1D_CLD[diff_freq];
|
||||
break;
|
||||
case MPS_ICC:
|
||||
hcod_first_band = ff_aac_hcod_firstband_ICC;
|
||||
hcod1D = ff_aac_hcod1D_ICC;
|
||||
break;
|
||||
case MPS_IPD:
|
||||
hcod_first_band = ff_aac_hcod_firstband_IPD;
|
||||
hcod1D = ff_aac_hcod1D_IPD[diff_freq];
|
||||
if (data_bands == 1)
|
||||
hcod1D = ff_aac_hcod1D_IPD[!diff_freq];
|
||||
break;
|
||||
default:
|
||||
av_unreachable("Invalid data type");
|
||||
}
|
||||
|
||||
if (p0_flag)
|
||||
data[0] = -(huff_dec_1D(gb, hcod_first_band) + 1);
|
||||
|
||||
for (int off = diff_freq; off < data_bands; off++) {
|
||||
int16_t val = -(huff_dec_1D(gb, hcod1D) + 1);
|
||||
if (val && data_type != MPS_IPD)
|
||||
val = get_bits1(gb) ? -val : val;
|
||||
data[off] = val;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void symmetry_data(GetBitContext *gb, int16_t data[2],
|
||||
uint8_t lav, enum AACMPSDataType data_type)
|
||||
{
|
||||
int16_t sum = data[0] + data[1];
|
||||
int16_t diff = data[0] - data[1];
|
||||
|
||||
if (sum > lav) {
|
||||
data[0] = -sum + (2*lav + 1);
|
||||
data[1] = -diff;
|
||||
} else {
|
||||
data[0] = sum;
|
||||
data[1] = diff;
|
||||
}
|
||||
|
||||
if ((data_type != MPS_IPD) && (data[0] + data[1])) {
|
||||
int sym = get_bits1(gb) ? -1 : 1;
|
||||
data[0] *= sym;
|
||||
data[1] *= sym;
|
||||
}
|
||||
|
||||
if (data[0] - data[1]) {
|
||||
if (get_bits1(gb))
|
||||
FFSWAP(int16_t, data[0], data[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/* NB: NOT a standard integer log2! */
|
||||
static int mps_log2(int s) {
|
||||
if (s)
|
||||
s--;
|
||||
int v = 0;
|
||||
while (s) {
|
||||
s >>= 1;
|
||||
v++;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static void pcm_decode(GetBitContext *gb, int16_t *data0, int16_t *data1,
|
||||
int16_t offset, int nb_pcm_data_bands,
|
||||
int nb_quant_steps, int nb_levels)
|
||||
{
|
||||
int max_group_len;
|
||||
switch (nb_levels) {
|
||||
case 3: max_group_len = 5; break;
|
||||
case 7: max_group_len = 6; break;
|
||||
case 11: max_group_len = 2; break;
|
||||
case 13: max_group_len = 4; break;
|
||||
case 19: max_group_len = 4; break;
|
||||
case 25: max_group_len = 3; break;
|
||||
case 51: max_group_len = 4; break;
|
||||
case 4: case 8: case 15: case 16: case 26: case 31:
|
||||
max_group_len = 1;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
};
|
||||
|
||||
av_assert1(data0 || data1);
|
||||
|
||||
int pcm_chunk_size[7] = { 0 };
|
||||
|
||||
int tmp = 1;
|
||||
for (int i = 1; i <= max_group_len; i++) {
|
||||
tmp *= nb_levels;
|
||||
pcm_chunk_size[i] = mps_log2(tmp);
|
||||
}
|
||||
|
||||
for (int i = 0; i < nb_pcm_data_bands; i+= max_group_len) {
|
||||
int group_len = FFMIN(max_group_len, nb_pcm_data_bands - i);
|
||||
|
||||
int pcm = get_bits(gb, pcm_chunk_size[group_len]);
|
||||
for (int j = 0; j < group_len; j++) {
|
||||
int idx = i + (group_len - 1) - j;
|
||||
int val = pcm % nb_levels;
|
||||
if (data0 && data1) {
|
||||
if (idx % 2)
|
||||
data1[idx / 2] = val - offset;
|
||||
else
|
||||
data0[idx / 2] = val - offset;
|
||||
} else if (!data1) {
|
||||
data0[idx] = val - offset;
|
||||
} else if (!data0) {
|
||||
data1[idx] = val - offset;
|
||||
}
|
||||
pcm = (pcm - val) / nb_levels;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void huff_data_2d(GetBitContext *gb, int16_t *part0_data[2], int16_t (*data)[2],
|
||||
int data_bands, int stride, enum AACMPSDataType data_type,
|
||||
int diff_freq, int freq_pair)
|
||||
{
|
||||
int16_t lav_idx = huff_dec_1D(gb, ff_aac_hcod_lav_idx);
|
||||
uint8_t lav = ff_aac_lav_tab_XXX[data_type][-(lav_idx + 1)];
|
||||
|
||||
const int16_t (*hcod1D)[2];
|
||||
const int16_t (*hcod2D)[2];
|
||||
switch (data_type) {
|
||||
case MPS_CLD:
|
||||
hcod1D = ff_aac_hcod_firstband_CLD;
|
||||
switch (lav) {
|
||||
case 3: hcod2D = ff_aac_hcod2D_CLD_03[freq_pair][diff_freq]; break;
|
||||
case 5: hcod2D = ff_aac_hcod2D_CLD_05[freq_pair][diff_freq]; break;
|
||||
case 7: hcod2D = ff_aac_hcod2D_CLD_07[freq_pair][diff_freq]; break;
|
||||
case 9: hcod2D = ff_aac_hcod2D_CLD_09[freq_pair][diff_freq]; break;
|
||||
}
|
||||
break;
|
||||
case MPS_ICC:
|
||||
hcod1D = ff_aac_hcod_firstband_ICC;
|
||||
switch (lav) {
|
||||
case 1: hcod2D = ff_aac_hcod2D_ICC_01[freq_pair][diff_freq]; break;
|
||||
case 3: hcod2D = ff_aac_hcod2D_ICC_03[freq_pair][diff_freq]; break;
|
||||
case 5: hcod2D = ff_aac_hcod2D_ICC_05[freq_pair][diff_freq]; break;
|
||||
case 7: hcod2D = ff_aac_hcod2D_ICC_07[freq_pair][diff_freq]; break;
|
||||
}
|
||||
break;
|
||||
case MPS_IPD:
|
||||
hcod1D = ff_aac_hcod_firstband_IPD;
|
||||
switch (lav) {
|
||||
case 1: hcod2D = ff_aac_hcod2D_IPD_01[freq_pair][diff_freq]; break;
|
||||
case 3: hcod2D = ff_aac_hcod2D_IPD_03[freq_pair][diff_freq]; break;
|
||||
case 5: hcod2D = ff_aac_hcod2D_IPD_05[freq_pair][diff_freq]; break;
|
||||
case 7: hcod2D = ff_aac_hcod2D_IPD_07[freq_pair][diff_freq]; break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
av_unreachable("Invalid data type");
|
||||
}
|
||||
|
||||
if (part0_data[0])
|
||||
part0_data[0][0] = -(huff_dec_1D(gb, hcod1D) + 1);
|
||||
if (part0_data[1])
|
||||
part0_data[1][0] = -(huff_dec_1D(gb, hcod1D) + 1);
|
||||
|
||||
int i = 0;
|
||||
int esc_cnt = 0;
|
||||
int16_t esc_data[2][28];
|
||||
int esc_idx[28];
|
||||
for (; i < data_bands; i += stride) {
|
||||
if (huff_dec_2D(gb, hcod2D, data[i]))
|
||||
esc_idx[esc_cnt++] = i; /* Escape */
|
||||
else
|
||||
symmetry_data(gb, data[i], lav, data_type);
|
||||
}
|
||||
|
||||
if (esc_cnt) {
|
||||
pcm_decode(gb, esc_data[0], esc_data[1],
|
||||
0, 2*esc_cnt, 0, (2*lav + 1));
|
||||
for (i = 0; i < esc_cnt; i++) {
|
||||
data[esc_idx[i]][0] = esc_data[0][i] - lav;
|
||||
data[esc_idx[i]][0] = esc_data[0][i] - lav;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int huff_decode(GetBitContext *gb, int16_t *data[2],
|
||||
enum AACMPSDataType data_type, int diff_freq[2],
|
||||
int num_val, int *time_pair)
|
||||
{
|
||||
int16_t pair_vec[28][2];
|
||||
int num_val_ch[2] = { num_val, num_val };
|
||||
int16_t *p0_data[2][2] = { 0 };
|
||||
int df_rest_flag[2] = { 0, 0 };
|
||||
|
||||
/* Coding scheme */
|
||||
int dim = get_bits1(gb);
|
||||
if (dim) { /* 2D */
|
||||
*time_pair = 0;
|
||||
if (data[0] && data[1])
|
||||
*time_pair = get_bits1(gb);
|
||||
|
||||
if (*time_pair) {
|
||||
if (diff_freq[0] || diff_freq[1]) {
|
||||
p0_data[0][0] = data[0];
|
||||
p0_data[0][1] = data[1];
|
||||
|
||||
data[0] += 1;
|
||||
data[1] += 1;
|
||||
|
||||
num_val_ch[0] -= 1;
|
||||
}
|
||||
|
||||
int diff_mode = 1;
|
||||
if (!diff_freq[0] || !diff_freq[1])
|
||||
diff_mode = 0; // time
|
||||
|
||||
huff_data_2d(gb, p0_data[0], pair_vec, num_val_ch[0], 1, data_type,
|
||||
diff_mode, 0);
|
||||
|
||||
for (int i = 0; i < num_val_ch[0]; i++) {
|
||||
data[0][i] = pair_vec[i][0];
|
||||
data[1][i] = pair_vec[i][1];
|
||||
}
|
||||
} else {
|
||||
if (data[0]) {
|
||||
if (diff_freq[0]) {
|
||||
p0_data[0][0] = data[0];
|
||||
p0_data[0][1] = NULL;
|
||||
|
||||
num_val_ch[0] -= 1;
|
||||
data[0]++;
|
||||
}
|
||||
df_rest_flag[0] = num_val_ch[0] % 2;
|
||||
if (df_rest_flag[0])
|
||||
num_val_ch[0] -= 1;
|
||||
if (num_val_ch[0] < 0)
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (data[1]) {
|
||||
if (diff_freq[1]) {
|
||||
p0_data[1][0] = NULL;
|
||||
p0_data[1][1] = data[1];
|
||||
|
||||
num_val_ch[1] -= 1;
|
||||
data[1]++;
|
||||
}
|
||||
df_rest_flag[1] = num_val_ch[1] % 2;
|
||||
if (df_rest_flag[1])
|
||||
num_val_ch[1] -= 1;
|
||||
if (num_val_ch[1] < 0)
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (data[0]) {
|
||||
huff_data_2d(gb, p0_data[0], pair_vec, num_val_ch[0], 2, data_type,
|
||||
diff_freq[0], 1);
|
||||
if (df_rest_flag[0])
|
||||
huff_data_1d(gb, data[0] + num_val_ch[0], 1,
|
||||
data_type, !diff_freq[0], 0);
|
||||
}
|
||||
if (data[1]) {
|
||||
huff_data_2d(gb, p0_data[1], pair_vec + 1, num_val_ch[1], 2, data_type,
|
||||
diff_freq[1], 1);
|
||||
if (df_rest_flag[1])
|
||||
huff_data_1d(gb, data[1] + num_val_ch[1], 1,
|
||||
data_type, !diff_freq[1], 0);
|
||||
}
|
||||
}
|
||||
} else { /* 1D */
|
||||
if (data[0])
|
||||
huff_data_1d(gb, data[0], num_val, data_type, diff_freq[0], diff_freq[0]);
|
||||
if (data[1])
|
||||
huff_data_1d(gb, data[1], num_val, data_type, diff_freq[1], diff_freq[1]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void diff_freq_decode(const int16_t *diff, int16_t *out, int nb_val)
|
||||
{
|
||||
int i = 0;
|
||||
out[0] = diff[0];
|
||||
for (i = 1; i < nb_val; i++)
|
||||
out[i] = out[i - 1] + diff[i];
|
||||
}
|
||||
|
||||
static void diff_time_decode_backwards(const int16_t *prev, const int16_t *diff,
|
||||
int16_t *out, const int mixed_diff_type,
|
||||
const int nb_val)
|
||||
{
|
||||
if (mixed_diff_type)
|
||||
out[0] = diff[0];
|
||||
for (int i = mixed_diff_type; i < nb_val; i++)
|
||||
out[i] = prev[i] + diff[i];
|
||||
}
|
||||
|
||||
static void diff_time_decode_forwards(const int16_t *prev, const int16_t *diff,
|
||||
int16_t *out, const int mixed_diff_type,
|
||||
const int nb_val)
|
||||
{
|
||||
if (mixed_diff_type)
|
||||
out[0] = diff[0];
|
||||
for (int i = mixed_diff_type; i < nb_val; i++)
|
||||
out[i] = prev[i] - diff[i];
|
||||
}
|
||||
|
||||
static void attach_lsb(GetBitContext *gb, int16_t *data_msb,
|
||||
int offset, int nb_lsb, int nb_val,
|
||||
int16_t *data)
|
||||
{
|
||||
for (int i = 0; i < nb_val; i++) {
|
||||
int msb = data_msb[i];
|
||||
if (nb_lsb > 0) {
|
||||
uint32_t lsb = get_bits(gb, nb_lsb);
|
||||
data[i] = ((msb << nb_lsb) | lsb) - offset;
|
||||
} else {
|
||||
data[i] = msb - offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int ec_pair_dec(GetBitContext *gb,
|
||||
int16_t set1[MPS_MAX_PARAM_BANDS],
|
||||
int16_t set2[MPS_MAX_PARAM_BANDS], int16_t *last,
|
||||
enum AACMPSDataType data_type, int start_band, int nb_bands,
|
||||
int pair, int coarse,
|
||||
int diff_time_back)
|
||||
{
|
||||
int attach_lsb_flag = 0;
|
||||
int quant_levels = 0;
|
||||
int quant_offset = 0;
|
||||
|
||||
switch (data_type) {
|
||||
case MPS_CLD:
|
||||
if (coarse) {
|
||||
attach_lsb_flag = 0;
|
||||
quant_levels = 15;
|
||||
quant_offset = 7;
|
||||
} else {
|
||||
attach_lsb_flag = 0;
|
||||
quant_levels = 31;
|
||||
quant_offset = 15;
|
||||
}
|
||||
break;
|
||||
case MPS_ICC:
|
||||
if (coarse) {
|
||||
attach_lsb_flag = 0;
|
||||
quant_levels = 4;
|
||||
quant_offset = 0;
|
||||
} else {
|
||||
attach_lsb_flag = 0;
|
||||
quant_levels = 8;
|
||||
quant_offset = 0;
|
||||
}
|
||||
break;
|
||||
case MPS_IPD:
|
||||
if (!coarse) {
|
||||
attach_lsb_flag = 1;
|
||||
quant_levels = 16;
|
||||
quant_offset = 0;
|
||||
} else {
|
||||
attach_lsb_flag = 0;
|
||||
quant_levels = 8;
|
||||
quant_offset = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
int16_t last_msb[28] = { 0 };
|
||||
int16_t data_pair[2][28] = { 0 };
|
||||
int16_t data_diff[2][28] = { 0 };
|
||||
int16_t *p_data[2];
|
||||
|
||||
int pcm_coding = get_bits1(gb);
|
||||
if (pcm_coding) { /* bsPcmCoding */
|
||||
int nb_pcm_vals;
|
||||
if (pair) {
|
||||
p_data[0] = data_pair[0];
|
||||
p_data[1] = data_pair[1];
|
||||
nb_pcm_vals = 2 * nb_bands;
|
||||
} else {
|
||||
p_data[0] = data_pair[0];
|
||||
p_data[1] = NULL;
|
||||
nb_pcm_vals = nb_bands;
|
||||
}
|
||||
|
||||
int nb_quant_steps;
|
||||
switch (data_type) {
|
||||
case MPS_CLD: nb_quant_steps = coarse ? 15 : 31; break;
|
||||
case MPS_ICC: nb_quant_steps = coarse ? 4 : 8; break;
|
||||
case MPS_IPD: nb_quant_steps = coarse ? 8 : 16; break;
|
||||
}
|
||||
pcm_decode(gb, p_data[0], p_data[1], quant_offset, nb_pcm_vals,
|
||||
nb_quant_steps, quant_levels);
|
||||
|
||||
memcpy(&set1[start_band], data_pair[0], 2*nb_bands);
|
||||
if (pair)
|
||||
memcpy(&set2[start_band], data_pair[1], 2*nb_bands);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pair) {
|
||||
p_data[0] = data_pair[0];
|
||||
p_data[1] = data_pair[1];
|
||||
} else {
|
||||
p_data[0] = data_pair[0];
|
||||
p_data[1] = NULL;
|
||||
}
|
||||
|
||||
int diff_freq[2] = { 1, 1 };
|
||||
int backwards = 1;
|
||||
|
||||
if (pair || diff_time_back)
|
||||
diff_freq[0] = !get_bits1(gb);
|
||||
|
||||
if (pair && (diff_freq[0] || diff_time_back))
|
||||
diff_freq[1] = !get_bits1(gb);
|
||||
|
||||
int time_pair;
|
||||
huff_decode(gb, p_data, data_type, diff_freq,
|
||||
nb_bands, &time_pair);
|
||||
|
||||
/* Differential decoding */
|
||||
if (!diff_freq[0] || !diff_freq[1]) {
|
||||
if (0 /* 1 if SAOC */) {
|
||||
backwards = 1;
|
||||
} else {
|
||||
if (pair) {
|
||||
if (!diff_freq[0] && !diff_time_back)
|
||||
backwards = 0;
|
||||
else if (!diff_freq[1])
|
||||
backwards = 1;
|
||||
else
|
||||
backwards = !get_bits1(gb);
|
||||
} else {
|
||||
backwards = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int mixed_time_pair = (diff_freq[0] != diff_freq[1]) && time_pair;
|
||||
|
||||
if (backwards) {
|
||||
if (diff_freq[0]) {
|
||||
diff_freq_decode(data_diff[0], data_pair[0], nb_bands);
|
||||
} else {
|
||||
for (int i = 0; i < nb_bands; i++) {
|
||||
last_msb[i] = last[i + start_band] + quant_offset;
|
||||
if (attach_lsb_flag) {
|
||||
last_msb[i] >>= 1;
|
||||
}
|
||||
}
|
||||
diff_time_decode_backwards(last_msb, data_diff[0], data_pair[0],
|
||||
mixed_time_pair, nb_bands);
|
||||
}
|
||||
|
||||
if (diff_freq[1])
|
||||
diff_freq_decode(data_diff[1], data_pair[1], nb_bands);
|
||||
else
|
||||
diff_time_decode_backwards(data_pair[0], data_diff[1],
|
||||
data_pair[1], mixed_time_pair, nb_bands);
|
||||
} else {
|
||||
diff_freq_decode(data_diff[1], data_pair[1], nb_bands);
|
||||
|
||||
if (diff_freq[0])
|
||||
diff_freq_decode(data_diff[0], data_pair[0], nb_bands);
|
||||
else
|
||||
diff_time_decode_forwards(data_pair[1], data_diff[0], data_pair[0],
|
||||
mixed_time_pair, nb_bands);
|
||||
}
|
||||
|
||||
/* Decode LSBs */
|
||||
attach_lsb(gb, p_data[0], quant_offset, attach_lsb_flag,
|
||||
nb_bands, p_data[0]);
|
||||
if (pair)
|
||||
attach_lsb(gb, p_data[1], quant_offset, attach_lsb_flag,
|
||||
nb_bands, p_data[1]);
|
||||
|
||||
memcpy(&set1[start_band], data_pair[0], 2*nb_bands);
|
||||
if (pair)
|
||||
memcpy(&set2[start_band], data_pair[1], 2*nb_bands);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void coarse_to_fine(int16_t *data, enum AACMPSDataType data_type,
|
||||
int start_band, int end_band)
|
||||
{
|
||||
for (int i = start_band; i < end_band; i++)
|
||||
data[i] *= 2;
|
||||
if (data_type == MPS_CLD) {
|
||||
for (int i = start_band; i < end_band; i++) {
|
||||
if (data[i] == -14)
|
||||
data[i] = -15;
|
||||
else if (data[i] == 14)
|
||||
data[i] = 15;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void fine_to_coarse(int16_t *data, enum AACMPSDataType data_type,
|
||||
int start_band, int end_band)
|
||||
{
|
||||
for (int i = start_band; i < end_band; i++) {
|
||||
if (data_type == MPS_CLD)
|
||||
data[i] /= 2;
|
||||
else
|
||||
data[i] >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int get_freq_strides(int16_t *freq_strides, int band_stride,
|
||||
int start_band, int end_band)
|
||||
{
|
||||
int data_bands = (end_band - start_band - 1) / band_stride + 1;
|
||||
|
||||
freq_strides[0] = start_band;
|
||||
for (int i = 1; i <= data_bands; i++)
|
||||
freq_strides[i] = freq_strides[i - 1] + band_stride;
|
||||
|
||||
int offs = 0;
|
||||
while (freq_strides[data_bands] > end_band) {
|
||||
if (offs < data_bands)
|
||||
offs++;
|
||||
for (int i = offs; i <= data_bands; i++) {
|
||||
freq_strides[i]--;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i <= data_bands; i++)
|
||||
freq_strides[i] = av_clip_uintp2(freq_strides[i], 2);
|
||||
|
||||
return data_bands;
|
||||
}
|
||||
|
||||
static const int stride_table[4] = { 1, 2, 5, 28 };
|
||||
|
||||
int ff_aac_ec_data_dec(GetBitContext *gb, AACMPSLosslessData *ld,
|
||||
enum AACMPSDataType data_type,
|
||||
int default_val,
|
||||
int start_band, int end_band, int frame_indep_flag,
|
||||
int indep_flag, int nb_param_sets)
|
||||
{
|
||||
for (int i = 0; i < nb_param_sets; i++) {
|
||||
ld->data_mode[i] = get_bits(gb, 2);
|
||||
/* Error checking */
|
||||
if ((indep_flag && !i && (ld->data_mode[i] == 1 || ld->data_mode[i] == 2)) ||
|
||||
((i == (nb_param_sets - 1) && (ld->data_mode[i] == 2)))) {
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
int set_idx = 0;
|
||||
int data_pair = 0;
|
||||
bool old_coarse = ld->quant_coarse_prev;
|
||||
|
||||
for (int i = 0; i < nb_param_sets; i++) {
|
||||
if (!ld->data_mode[i]) {
|
||||
for (int j = start_band; j < end_band; j++)
|
||||
ld->last_data[j] = default_val;
|
||||
old_coarse = 0;
|
||||
}
|
||||
|
||||
if (ld->data_mode[i] != 3) {
|
||||
continue;
|
||||
} else if (data_pair) {
|
||||
data_pair = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
data_pair = get_bits1(gb);
|
||||
ld->coarse_quant[set_idx] = get_bits1(gb);
|
||||
ld->freq_res[set_idx] = get_bits(gb, 2);
|
||||
|
||||
if (ld->coarse_quant[set_idx] != old_coarse) {
|
||||
if (old_coarse)
|
||||
coarse_to_fine(ld->last_data, data_type, start_band, end_band);
|
||||
else
|
||||
fine_to_coarse(ld->last_data, data_type, start_band, end_band);
|
||||
}
|
||||
|
||||
int data_bands = get_freq_strides(ld->freq_res,
|
||||
stride_table[ld->freq_res[set_idx]],
|
||||
start_band, end_band);
|
||||
|
||||
if (set_idx + data_pair > MPS_MAX_PARAM_SETS)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
for (int j = 0; j < data_bands; j++)
|
||||
ld->last_data[start_band + j] = ld->last_data[ld->freq_res[j]];
|
||||
|
||||
int err = ec_pair_dec(gb,
|
||||
ld->data[set_idx + 0], ld->data[set_idx + 1],
|
||||
ld->last_data, data_type, start_band, end_band - start_band,
|
||||
data_pair, ld->coarse_quant[set_idx],
|
||||
!(indep_flag && (i == 0)) || (set_idx > 0));
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (data_type == MPS_IPD) {
|
||||
const int mask = ld->coarse_quant[set_idx] ? 0x7 : 0xF;
|
||||
for (int j = 0; j < data_bands; j++)
|
||||
for (int k = ld->freq_res[j + 0]; k < ld->freq_res[j + 1]; k++)
|
||||
ld->last_data[k] = ld->data[set_idx + data_pair][start_band + j] & mask;
|
||||
} else {
|
||||
for (int j = 0; j < data_bands; j++)
|
||||
for (int k = ld->freq_res[j + 0]; k < ld->freq_res[j + 1]; k++)
|
||||
ld->last_data[k] = ld->data[set_idx + data_pair][start_band + j];
|
||||
}
|
||||
|
||||
old_coarse = ld->coarse_quant[set_idx];
|
||||
if (data_pair) {
|
||||
ld->coarse_quant[set_idx + 1] = ld->coarse_quant[set_idx];
|
||||
ld->freq_res[set_idx + 1] = ld->freq_res[set_idx];
|
||||
}
|
||||
set_idx += data_pair + 1;
|
||||
}
|
||||
|
||||
ld->quant_coarse_prev = old_coarse;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_aac_huff_dec_reshape(GetBitContext *gb, int16_t *out_data,
|
||||
int nb_val)
|
||||
{
|
||||
int val, len;
|
||||
int val_received = 0;
|
||||
int16_t rl_data[2] = { 0 };
|
||||
|
||||
while (val_received < nb_val) {
|
||||
huff_dec_2D(gb, ff_aac_hcod2D_reshape, rl_data);
|
||||
val = rl_data[0];
|
||||
len = rl_data[1] + 1;
|
||||
if (val_received + len > nb_val)
|
||||
return AVERROR(EINVAL);
|
||||
for (int i = val_received; i < val_received + len; i++)
|
||||
out_data[i] = val;
|
||||
val_received += len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void create_mapping(int map[MPS_MAX_PARAM_BANDS + 1],
|
||||
int start_band, int stop_band, int stride)
|
||||
{
|
||||
int diff[MPS_MAX_PARAM_BANDS + 1];
|
||||
int src_bands = stop_band - start_band;
|
||||
int dst_bands = (src_bands - 1) / stride + 1;
|
||||
|
||||
if (dst_bands < 1)
|
||||
dst_bands = 1;
|
||||
|
||||
int bands_achived = dst_bands * stride;
|
||||
int bands_diff = src_bands - bands_achived;
|
||||
for (int i = 0; i < dst_bands; i++)
|
||||
diff[i] = stride;
|
||||
|
||||
int incr, k;
|
||||
if (bands_diff > 0) {
|
||||
incr = -1;
|
||||
k = dst_bands - 1;
|
||||
} else {
|
||||
incr = 1;
|
||||
k = 0;
|
||||
}
|
||||
|
||||
while (bands_diff != 0) {
|
||||
diff[k] = diff[k] - incr;
|
||||
k = k + incr;
|
||||
bands_diff = bands_diff + incr;
|
||||
if (k >= dst_bands) {
|
||||
if (bands_diff > 0) {
|
||||
k = dst_bands - 1;
|
||||
} else if (bands_diff < 0) {
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
map[0] = start_band;
|
||||
for (int i = 0; i < dst_bands; i++)
|
||||
map[i + 1] = map[i] + diff[i];
|
||||
}
|
||||
|
||||
static void map_freq(int16_t *dst, const int16_t *src,
|
||||
int *map, int nb_bands)
|
||||
{
|
||||
for (int i = 0; i < nb_bands; i++) {
|
||||
int value = src[i + map[0]];
|
||||
int start_band = map[i];
|
||||
int stop_band = map[i + 1];
|
||||
for (int j = start_band; j < stop_band; j++) {
|
||||
dst[j] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int deq_idx(int value, enum AACMPSDataType data_type)
|
||||
{
|
||||
int idx = -1;
|
||||
|
||||
switch (data_type) {
|
||||
case MPS_CLD:
|
||||
if (((value + 15) >= 0) && ((value + 15) < 31))
|
||||
idx = (value + 15);
|
||||
break;
|
||||
case MPS_ICC:
|
||||
if ((value >= 0) && (value < 8))
|
||||
idx = value;
|
||||
break;
|
||||
case MPS_IPD:
|
||||
/* (+/-)15 * MAX_PARAMETER_BANDS for differential coding in frequency
|
||||
* domain (according to rbl) */
|
||||
if ((value >= -420) && (value <= 420))
|
||||
idx = (value & 0xf);
|
||||
break;
|
||||
}
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
int ff_aac_map_index_data(AACMPSLosslessData *ld,
|
||||
enum AACMPSDataType data_type,
|
||||
int dst_idx[MPS_MAX_PARAM_SETS][MPS_MAX_PARAM_BANDS],
|
||||
int default_value, int start_band, int stop_band,
|
||||
int nb_param_sets, const int *param_set_idx,
|
||||
int extend_frame)
|
||||
{
|
||||
if (nb_param_sets > MPS_MAX_PARAM_SETS)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
int data_mode_3_idx[MPS_MAX_PARAM_SETS] = { 0 };
|
||||
int nb_data_mode_3 = 0;
|
||||
for (int i = 0; i < nb_param_sets; i++) {
|
||||
if (ld->data_mode[i] == 3) {
|
||||
data_mode_3_idx[nb_data_mode_3] = i;
|
||||
nb_data_mode_3++;
|
||||
}
|
||||
}
|
||||
|
||||
int set_idx = 0;
|
||||
|
||||
/* Prepare data */
|
||||
int interpolate[MPS_MAX_PARAM_SETS] = { 0 };
|
||||
int16_t tmp_idx_data[MPS_MAX_PARAM_SETS][MPS_MAX_PARAM_BANDS] = { 0 };
|
||||
for (int i = 0; i < nb_param_sets; i++) {
|
||||
if (ld->data_mode[i] == 0) {
|
||||
ld->coarse_quant_no[i] = 0;
|
||||
for (int band = start_band; band < stop_band; band++)
|
||||
tmp_idx_data[i][band] = default_value;
|
||||
for (int band = start_band; band < stop_band; band++)
|
||||
ld->last_data[band] = tmp_idx_data[i][band];
|
||||
ld->quant_coarse_prev = 0;
|
||||
}
|
||||
|
||||
if (ld->data_mode[i] == 1) {
|
||||
for (int band = start_band; band < stop_band; band++)
|
||||
tmp_idx_data[i][band] = ld->last_data[band];
|
||||
ld->coarse_quant_no[i] = ld->quant_coarse_prev;
|
||||
}
|
||||
|
||||
if (ld->data_mode[i] == 2) {
|
||||
for (int band = start_band; band < stop_band; band++)
|
||||
tmp_idx_data[i][band] = ld->last_data[band];
|
||||
ld->coarse_quant_no[i] = ld->quant_coarse_prev;
|
||||
interpolate[i] = 1;
|
||||
} else {
|
||||
interpolate[i] = 0;
|
||||
}
|
||||
|
||||
if (ld->data_mode[i] == 3) {
|
||||
int stride;
|
||||
|
||||
int parmSlot = data_mode_3_idx[set_idx];
|
||||
stride = stride_table[ld->freq_res[set_idx]];
|
||||
int dataBands = (stop_band - start_band - 1) / stride + 1;
|
||||
|
||||
int tmp[MPS_MAX_PARAM_BANDS + 1];
|
||||
create_mapping(tmp, start_band, stop_band, stride);
|
||||
map_freq(tmp_idx_data[parmSlot], ld->data[set_idx],
|
||||
tmp, dataBands);
|
||||
|
||||
for (int band = start_band; band < stop_band; band++)
|
||||
ld->last_data[band] = tmp_idx_data[parmSlot][band];
|
||||
|
||||
ld->quant_coarse_prev = ld->coarse_quant[set_idx];
|
||||
ld->coarse_quant_no[i] = ld->coarse_quant[set_idx];
|
||||
|
||||
set_idx++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Map all coarse data to fine */
|
||||
for (int i = 0; i < nb_param_sets; i++) {
|
||||
if (ld->coarse_quant_no[i] == 1) {
|
||||
coarse_to_fine(tmp_idx_data[i], data_type, start_band,
|
||||
stop_band - start_band);
|
||||
ld->coarse_quant_no[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Interpolate */
|
||||
int i1 = 0;
|
||||
for (int i = 0; i < nb_param_sets; i++) {
|
||||
if (interpolate[i] != 1) {
|
||||
i1 = i;
|
||||
} else {
|
||||
int xi, i2, x1, x2;
|
||||
|
||||
for (i2 = i; i2 < nb_param_sets; i2++)
|
||||
if (interpolate[i2] != 1)
|
||||
break;
|
||||
if (i2 >= nb_param_sets)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
x1 = param_set_idx[i1];
|
||||
xi = param_set_idx[i];
|
||||
x2 = param_set_idx[i2];
|
||||
|
||||
for (int band = start_band; band < stop_band; band++) {
|
||||
int yi, y1, y2;
|
||||
y1 = tmp_idx_data[i1][band];
|
||||
y2 = tmp_idx_data[i2][band];
|
||||
if (x1 != x2) {
|
||||
yi = y1 + (xi - x1) * (y2 - y1) / (x2 - x1);
|
||||
} else {
|
||||
yi = y1 /*+ (xi-x1)*(y2-y1)/1e-12*/;
|
||||
}
|
||||
tmp_idx_data[i][band] = yi;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Dequantize data and apply factorCLD if necessary */
|
||||
for (int ps = 0; ps < nb_param_sets; ps++) {
|
||||
/* Dequantize data */
|
||||
for (int band = start_band; band < stop_band; band++) {
|
||||
dst_idx[ps][band] = deq_idx(tmp_idx_data[ps][band],
|
||||
data_type);
|
||||
if (dst_idx[ps][band] == -1)
|
||||
dst_idx[ps][band] = default_value;
|
||||
}
|
||||
}
|
||||
|
||||
if (extend_frame) {
|
||||
if (data_type == MPS_IPD)
|
||||
ld->coarse_quant[nb_param_sets] = ld->coarse_quant[nb_param_sets - 1];
|
||||
for (int band = start_band; band < stop_band; band++)
|
||||
dst_idx[nb_param_sets][band] = dst_idx[nb_param_sets - 1][band];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2025 Lynne <dev@lynne.ee>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it 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_AACDEC_USAC_MPS212_H
|
||||
#define AVCODEC_AAC_AACDEC_USAC_MPS212_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "libavcodec/get_bits.h"
|
||||
#include "libavcodec/aac.h"
|
||||
|
||||
enum AACMPSDataType {
|
||||
MPS_CLD = 0,
|
||||
MPS_ICC,
|
||||
MPS_IPD,
|
||||
|
||||
MPS_ELE_NB,
|
||||
};
|
||||
|
||||
typedef struct AACMPSLosslessData {
|
||||
int16_t data[MPS_MAX_PARAM_SETS][MPS_MAX_PARAM_BANDS];
|
||||
int16_t last_data[MPS_MAX_PARAM_BANDS];
|
||||
|
||||
int16_t data_mode[MPS_MAX_PARAM_SETS];
|
||||
bool coarse_quant[MPS_MAX_PARAM_SETS];
|
||||
int16_t freq_res[MPS_MAX_PARAM_SETS];
|
||||
int16_t coarse_quant_no[MPS_MAX_PARAM_SETS];
|
||||
|
||||
bool quant_coarse_prev;
|
||||
} AACMPSLosslessData;
|
||||
|
||||
int ff_aac_ec_data_dec(GetBitContext *gb, AACMPSLosslessData *ld,
|
||||
enum AACMPSDataType data_type,
|
||||
int default_val,
|
||||
int start_band, int end_band, int frame_indep_flag,
|
||||
int indep_flag, int nb_param_sets);
|
||||
|
||||
int ff_aac_map_index_data(AACMPSLosslessData *ld,
|
||||
enum AACMPSDataType data_type,
|
||||
int dst_idx[MPS_MAX_PARAM_SETS][MPS_MAX_PARAM_BANDS],
|
||||
int default_value, int start_band, int stop_band,
|
||||
int nb_param_sets, const int *param_set_idx,
|
||||
int extend_frame);
|
||||
|
||||
int ff_aac_huff_dec_reshape(GetBitContext *gb, int16_t *out_data,
|
||||
int nb_val);
|
||||
|
||||
#endif /* AVCODEC_AAC_AACDEC_USAC_MPS212_H */
|
||||
@@ -147,15 +147,15 @@ get_next:
|
||||
} else {
|
||||
#if CONFIG_AAC_PARSER
|
||||
AACADTSHeaderInfo hdr;
|
||||
GetBitContext gb;
|
||||
|
||||
init_get_bits8(&gb, buf, buf_size);
|
||||
if (buf_size < AV_AAC_ADTS_HEADER_SIZE ||
|
||||
ff_adts_header_parse_buf(buf, &hdr) < 0)
|
||||
ff_adts_header_parse(&gb, &hdr) < 0)
|
||||
return i;
|
||||
|
||||
if (avctx->profile == AV_PROFILE_UNKNOWN)
|
||||
avctx->profile = hdr.object_type - 1;
|
||||
/* ADTS does not support USAC */
|
||||
s1->key_frame = 1;
|
||||
avctx->profile = hdr.object_type - 1;
|
||||
s1->key_frame = (avctx->profile == AV_PROFILE_AAC_USAC) ? get_bits1(&gb) : 1;
|
||||
bit_rate = hdr.bit_rate;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "aac_ac3_parser.h"
|
||||
#include "adts_header.h"
|
||||
#include "adts_parser.h"
|
||||
#include "parser_internal.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
|
||||
static int aac_sync(uint64_t state, int *need_next_header, int *new_frame_start)
|
||||
@@ -52,10 +51,10 @@ static av_cold int aac_parse_init(AVCodecParserContext *s1)
|
||||
}
|
||||
|
||||
|
||||
const FFCodecParser ff_aac_parser = {
|
||||
PARSER_CODEC_LIST(AV_CODEC_ID_AAC),
|
||||
const AVCodecParser ff_aac_parser = {
|
||||
.codec_ids = { AV_CODEC_ID_AAC },
|
||||
.priv_data_size = sizeof(AACAC3ParseContext),
|
||||
.init = aac_parse_init,
|
||||
.parse = ff_aac_ac3_parse,
|
||||
.close = ff_parse_close,
|
||||
.parser_init = aac_parse_init,
|
||||
.parser_parse = ff_aac_ac3_parse,
|
||||
.parser_close = ff_parse_close,
|
||||
};
|
||||
|
||||
@@ -173,7 +173,7 @@ static av_always_inline float quantize_and_encode_band_cost_template(
|
||||
if (BT_ESC) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
if (ff_aac_codebook_vectors[cb-1][curidx*2+j] == 64.0f) {
|
||||
int coef = av_clip(quant(fabsf(in[i+j]), Q, ROUNDING), 16, (1 << 13) - 1);
|
||||
int coef = av_clip_uintp2(quant(fabsf(in[i+j]), Q, ROUNDING), 13);
|
||||
int len = av_log2(coef);
|
||||
|
||||
put_bits(pb, len - 4 + 1, (1 << (len - 4 + 1)) - 2);
|
||||
|
||||
@@ -50,7 +50,7 @@ static inline void quantize_bands(int *out, const float *in, const float *scaled
|
||||
{
|
||||
for (int i = 0; i < size; i++) {
|
||||
float qc = scaled[i] * Q34;
|
||||
int tmp = (int)FFMIN((float)(qc + rounding), (float)maxval);
|
||||
int tmp = (int)FFMIN(qc + rounding, (float)maxval);
|
||||
if (is_signed && in[i] < 0.0f) {
|
||||
tmp = -tmp;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ static inline void ff_aacenc_dsp_init(AACEncDSPContext *s)
|
||||
|
||||
#if ARCH_RISCV
|
||||
ff_aacenc_dsp_init_riscv(s);
|
||||
#elif ARCH_X86 && HAVE_X86ASM
|
||||
#elif ARCH_X86
|
||||
ff_aacenc_dsp_init_x86(s);
|
||||
#elif ARCH_AARCH64
|
||||
ff_aacenc_dsp_init_aarch64(s);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user