Merge branch 'master' into oldabi
* master: (403 commits) Initial caf muxer. Support decoding of amr_nb and gsm in caf. Fix decoding of msrle samples with 1bpp. udp: remove resource.h inclusion, it breaks mingw compilation. ffmpeg: Allow seting and cycling through debug modes. Fix FSF address copy paste error in some license headers. Add an aac sample which uses LTP to fate-aac. ffmpeg: Help for interactive keys. UDP: dont use thread_t as truth value. swscale: fix compile on mingw32 [PATCH] Update pixdesc_be fate refs after adding 9/10bit YUV420P formats. arm: properly mark external symbol call ffmpeg: Interactivity support. Try pressing +-hs. swscale: 10l forgot git add this change from ronald. AVFrame: only set parameters from AVCodecContext in decode_video*() when no frame reordering is used. avcodec_default_get_buffer: init picture parameters. swscale: properly inline bits/endianness in yuv2yuvX16inC(). swscale: fix clipping of 9/10bit YUV420P. Add av_clip_uintp2() function Support more QT 1bpp rawvideo files. ... Conflicts: libavcodec/flacenc.c libavcodec/h261dec.c libavcodec/h263dec.c libavcodec/mpeg12.c libavcodec/msrle.c libavcodec/options.c libavcodec/qpeg.c libavcodec/rv34.c libavcodec/svq1dec.c libavcodec/svq3.c libavcodec/vc1dec.c libavcodec/version.h libavfilter/avfilter.h libavformat/file.c libavformat/options.c libavformat/rtpproto.c libavformat/udp.c libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
d46aada5c2
@ -12,6 +12,9 @@ version <next>:
|
||||
- Lots of deprecated API cruft removed
|
||||
- fft and imdct optimizations for AVX (Sandy Bridge) processors
|
||||
- showinfo filter added
|
||||
- DPX image encoder
|
||||
- SMPTE 302M AES3 audio decoder
|
||||
- Apple Core Audio Format muxer
|
||||
|
||||
|
||||
version 0.7_beta1:
|
||||
|
6
Makefile
6
Makefile
@ -280,9 +280,13 @@ fate-seek: $(FATE_SEEK)
|
||||
|
||||
ifdef SAMPLES
|
||||
FATE += $(FATE_TESTS)
|
||||
fate-rsync:
|
||||
rsync -vaLW rsync://fate-suite.libav.org/fate-suite/ $(SAMPLES)
|
||||
else
|
||||
fate-rsync:
|
||||
@echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the fate suite"
|
||||
$(FATE_TESTS):
|
||||
@echo "SAMPLES not specified, cannot run FATE"
|
||||
@echo "SAMPLES not specified, cannot run FATE. See doc/fate.txt for more information."
|
||||
endif
|
||||
|
||||
FATE_UTILS = base64 tiny_psnr
|
||||
|
@ -84,6 +84,7 @@ void uninit_opts(void)
|
||||
}
|
||||
av_freep(&opt_names);
|
||||
av_freep(&opt_values);
|
||||
opt_name_count = 0;
|
||||
}
|
||||
|
||||
void log_callback_help(void* ptr, int level, const char* fmt, va_list vl)
|
||||
@ -434,7 +435,7 @@ void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec)
|
||||
const char *str;
|
||||
if (priv_ctx) {
|
||||
if (av_find_opt(priv_ctx, opt_names[i], NULL, flags, flags)) {
|
||||
if (av_set_string3(priv_ctx, opt_names[i], opt_values[i], 0, NULL) < 0) {
|
||||
if (av_set_string3(priv_ctx, opt_names[i], opt_values[i], 1, NULL) < 0) {
|
||||
fprintf(stderr, "Invalid value '%s' for option '%s'\n",
|
||||
opt_names[i], opt_values[i]);
|
||||
exit(1);
|
||||
@ -907,10 +908,12 @@ int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
|
||||
|
||||
memcpy(frame->data, picref->data, sizeof(frame->data));
|
||||
memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize));
|
||||
frame->pkt_pos = picref->pos;
|
||||
frame->interlaced_frame = picref->video->interlaced;
|
||||
frame->top_field_first = picref->video->top_field_first;
|
||||
frame->key_frame = picref->video->key_frame;
|
||||
frame->pict_type = picref->video->pict_type;
|
||||
frame->sample_aspect_ratio = picref->video->sample_aspect_ratio;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -122,7 +122,8 @@ typedef struct {
|
||||
#define OPT_FUNC2 0x0400
|
||||
#define OPT_INT64 0x0800
|
||||
#define OPT_EXIT 0x1000
|
||||
#define OPT_DUMMY 0x2000
|
||||
#define OPT_DATA 0x2000
|
||||
#define OPT_DUMMY 0x4000
|
||||
union {
|
||||
void (*func_arg)(const char *); //FIXME passing error code as int return would be nicer then exit() in the func
|
||||
int *int_arg;
|
||||
|
53
configure
vendored
53
configure
vendored
@ -88,13 +88,12 @@ Configuration options:
|
||||
--disable-avcodec disable libavcodec build
|
||||
--disable-avformat disable libavformat build
|
||||
--disable-swscale disable libswscale build
|
||||
--enable-postproc enable GPLed postprocessing support [no]
|
||||
--disable-postproc disable libpostproc build
|
||||
--disable-avfilter disable video filter support [no]
|
||||
--disable-pthreads disable pthreads [auto]
|
||||
--enable-w32threads use Win32 threads [no]
|
||||
--enable-x11grab enable X11 grabbing [no]
|
||||
--disable-network disable network support [no]
|
||||
--disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no]
|
||||
--enable-gray enable full grayscale support (slower color)
|
||||
--disable-swscale-alpha disable alpha channel support in swscale
|
||||
--disable-fastdiv disable table-based division
|
||||
@ -761,7 +760,7 @@ check_pkg_config(){
|
||||
headers="$2"
|
||||
funcs="$3"
|
||||
shift 3
|
||||
$pkg_config --exists $pkg || return
|
||||
$pkg_config --exists $pkg 2>/dev/null || return
|
||||
pkg_cflags=$($pkg_config --cflags $pkg)
|
||||
pkg_libs=$($pkg_config --libs $pkg)
|
||||
check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
|
||||
@ -957,7 +956,6 @@ CONFIG_LIST="
|
||||
mdct
|
||||
memalign_hack
|
||||
mlib
|
||||
mpegaudio_hp
|
||||
network
|
||||
nonfree
|
||||
pic
|
||||
@ -1252,14 +1250,14 @@ aac_encoder_select="mdct sinewin"
|
||||
aac_latm_decoder_select="aac_decoder aac_latm_parser"
|
||||
ac3_decoder_select="mdct ac3dsp ac3_parser"
|
||||
ac3_encoder_select="mdct ac3dsp"
|
||||
ac3_fixed_encoder_select="ac3dsp"
|
||||
ac3_fixed_encoder_select="mdct ac3dsp"
|
||||
alac_encoder_select="lpc"
|
||||
amrnb_decoder_select="lsp"
|
||||
amrwb_decoder_select="lsp"
|
||||
atrac1_decoder_select="mdct sinewin"
|
||||
atrac3_decoder_select="mdct"
|
||||
binkaudio_dct_decoder_select="mdct rdft dct"
|
||||
binkaudio_rdft_decoder_select="mdct rdft"
|
||||
binkaudio_dct_decoder_select="mdct rdft dct sinewin"
|
||||
binkaudio_rdft_decoder_select="mdct rdft sinewin"
|
||||
cavs_decoder_select="golomb"
|
||||
cook_decoder_select="mdct sinewin"
|
||||
cscd_decoder_suggest="zlib"
|
||||
@ -1291,7 +1289,7 @@ h264_dxva2_hwaccel_deps="dxva2api_h"
|
||||
h264_dxva2_hwaccel_select="dxva2 h264_decoder"
|
||||
h264_vaapi_hwaccel_select="vaapi"
|
||||
h264_vdpau_decoder_select="vdpau h264_decoder"
|
||||
imc_decoder_select="fft mdct"
|
||||
imc_decoder_select="fft mdct sinewin"
|
||||
jpegls_decoder_select="golomb"
|
||||
jpegls_encoder_select="golomb"
|
||||
ljpeg_encoder_select="aandct"
|
||||
@ -1459,7 +1457,7 @@ alsa_outdev_deps="alsa_asoundlib_h"
|
||||
bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
|
||||
dv1394_indev_deps="dv1394 dv_demuxer"
|
||||
fbdev_indev_deps="linux_fb_h"
|
||||
jack_indev_deps="jack_jack_h"
|
||||
jack_indev_deps="jack_jack_h sem_timedwait"
|
||||
libdc1394_indev_deps="libdc1394"
|
||||
oss_indev_deps_any="soundcard_h sys_soundcard_h"
|
||||
oss_outdev_deps_any="soundcard_h sys_soundcard_h"
|
||||
@ -1481,7 +1479,7 @@ mmst_protocol_deps="network"
|
||||
rtmp_protocol_select="tcp_protocol"
|
||||
rtp_protocol_select="udp_protocol"
|
||||
tcp_protocol_deps="network"
|
||||
udp_protocol_deps="network"
|
||||
udp_protocol_deps="network pthreads"
|
||||
|
||||
# filters
|
||||
blackframe_filter_deps="gpl"
|
||||
@ -1490,7 +1488,8 @@ drawtext_filter_deps="libfreetype"
|
||||
frei0r_filter_deps="frei0r dlopen strtok_r"
|
||||
frei0r_src_filter_deps="frei0r dlopen strtok_r"
|
||||
hqdn3d_filter_deps="gpl"
|
||||
mp_filter_deps="gpl"
|
||||
movie_filter_deps="avcodec avformat"
|
||||
mp_filter_deps="gpl avcodec"
|
||||
ocv_filter_deps="libopencv"
|
||||
scale_filter_deps="swscale"
|
||||
yadif_filter_deps="gpl"
|
||||
@ -1498,6 +1497,7 @@ yadif_filter_deps="gpl"
|
||||
# libraries
|
||||
avdevice_deps="avcodec avformat"
|
||||
avformat_deps="avcodec"
|
||||
postproc_deps="gpl"
|
||||
|
||||
# programs
|
||||
ffmpeg_deps="avcodec avformat swscale"
|
||||
@ -1666,9 +1666,9 @@ enable ffmpeg
|
||||
enable ffplay
|
||||
enable ffprobe
|
||||
enable ffserver
|
||||
enable mpegaudio_hp
|
||||
enable network
|
||||
enable optimizations
|
||||
enable postproc
|
||||
enable protocols
|
||||
enable static
|
||||
enable stripping
|
||||
@ -1691,7 +1691,7 @@ LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
|
||||
|
||||
CC_O='-o $@'
|
||||
|
||||
host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
|
||||
host_cflags='-D_ISOC99_SOURCE -O3 -g -Wall'
|
||||
host_libs='-lm'
|
||||
|
||||
target_path='$(CURDIR)'
|
||||
@ -1856,6 +1856,11 @@ set_default cc nm pkg_config strip sysinclude
|
||||
enabled cross_compile || host_cc_default=$cc
|
||||
set_default host_cc
|
||||
|
||||
if ! $pkg_config --version >/dev/null 2>&1; then
|
||||
warn "$pkg_config not found, library detection may fail."
|
||||
pkg_config=false
|
||||
fi
|
||||
|
||||
exesuf() {
|
||||
case $1 in
|
||||
mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
|
||||
@ -2339,7 +2344,7 @@ if test "$?" != 0; then
|
||||
die "C compiler test failed."
|
||||
fi
|
||||
|
||||
add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
|
||||
add_cppflags -D_ISOC99_SOURCE
|
||||
check_cflags -std=c99
|
||||
check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
|
||||
#include <stdlib.h>
|
||||
@ -2387,7 +2392,6 @@ case $target_os in
|
||||
disable symver
|
||||
oss_indev_extralibs="-lossaudio"
|
||||
oss_outdev_extralibs="-lossaudio"
|
||||
add_cppflags -D_XOPEN_SOURCE=600
|
||||
;;
|
||||
openbsd)
|
||||
enable malloc_aligned
|
||||
@ -2481,6 +2485,7 @@ case $target_os in
|
||||
enable dos_paths
|
||||
;;
|
||||
linux)
|
||||
add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
|
||||
enable dv1394
|
||||
;;
|
||||
irix*)
|
||||
@ -2556,7 +2561,6 @@ die_license_disabled() {
|
||||
die_license_disabled gpl libx264
|
||||
die_license_disabled gpl libxavs
|
||||
die_license_disabled gpl libxvid
|
||||
die_license_disabled gpl postproc
|
||||
die_license_disabled gpl x11grab
|
||||
|
||||
die_license_disabled nonfree libfaac
|
||||
@ -2899,7 +2903,7 @@ enabled libdirac && require_pkg_config dirac \
|
||||
"libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
|
||||
"dirac_decoder_init dirac_encoder_init"
|
||||
enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
|
||||
enabled libfreetype && add_cflags $(pkg-config --cflags freetype2) && require libfreetype ft2build.h FT_Init_FreeType -lfreetype
|
||||
enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
|
||||
enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
|
||||
enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
|
||||
enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
|
||||
@ -2935,10 +2939,20 @@ if enabled libdc1394; then
|
||||
die "ERROR: No version of libdc1394 found "
|
||||
fi
|
||||
|
||||
if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
|
||||
SDL_CONFIG="${cross_prefix}sdl-config"
|
||||
if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
|
||||
sdl_cflags=$("${SDL_CONFIG}" --cflags)
|
||||
sdl_libs=$("${SDL_CONFIG}" --libs)
|
||||
check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
|
||||
check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
|
||||
enable sdl &&
|
||||
check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
|
||||
else
|
||||
if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
|
||||
check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
|
||||
enable sdl &&
|
||||
check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
|
||||
fi
|
||||
fi
|
||||
|
||||
texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
|
||||
@ -2975,7 +2989,7 @@ check_header soundcard.h
|
||||
|
||||
enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
|
||||
|
||||
enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
|
||||
enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait
|
||||
|
||||
enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
|
||||
|
||||
@ -3017,6 +3031,7 @@ check_cflags -Wwrite-strings
|
||||
check_cflags -Wtype-limits
|
||||
check_cflags -Wundef
|
||||
check_cflags -Wmissing-prototypes
|
||||
check_cflags -Wno-pointer-to-int-cast
|
||||
enabled extra_warnings && check_cflags -Winline
|
||||
|
||||
# add some linker flags
|
||||
|
@ -13,15 +13,45 @@ libavutil: 2011-04-18
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2011-04-XX - bebe72f - lavu 51.1.0 - avutil.h
|
||||
2011-05-10 - 188dea1 - lavc 53.3.0 - avcodec.h
|
||||
Deprecate AVLPCType and the following fields in
|
||||
AVCodecContext: lpc_coeff_precision, prediction_order_method,
|
||||
min_partition_order, max_partition_order, lpc_type, lpc_passes.
|
||||
Corresponding FLAC encoder options should be used instead.
|
||||
|
||||
2011-05-07 - xxxxxxx - lavfi 2.5.0 - avcodec.h
|
||||
Add libavfilter/avcodec.h header and avfilter_copy_frame_props()
|
||||
function.
|
||||
|
||||
2011-05-07 - xxxxxxx - lavc 53.5.0 - AVFrame
|
||||
Add format field to AVFrame.
|
||||
|
||||
2011-05-07 - xxxxxxx - lavc 53.4.0 - AVFrame
|
||||
Add width and height fields to AVFrame.
|
||||
|
||||
2011-05-01 - xxxxxxx - lavfi 2.4.0 - avfilter.h
|
||||
Rename AVFilterBufferRefVideoProps.pixel_aspect to
|
||||
sample_aspect_ratio.
|
||||
|
||||
2011-05-01 - xxxxxxx - lavc 53.3.0 - AVFrame
|
||||
Add a sample_aspect_ratio field to AVFrame.
|
||||
|
||||
2011-05-01 - xxxxxxx - lavc 53.2.0 - AVFrame
|
||||
Add a pkt_pos field to AVFrame.
|
||||
|
||||
2011-04-xx - xxxxxxx - lavu 51.2.0 - mem.h
|
||||
Add av_dynarray_add function for adding
|
||||
an element to a dynamic array.
|
||||
|
||||
2011-04-26 - bebe72f - lavu 51.1.0 - avutil.h
|
||||
Add AVPictureType enum and av_get_picture_type_char(), deprecate
|
||||
FF_*_TYPE defines and av_get_pict_type_char() defined in
|
||||
libavcodec/avcodec.h.
|
||||
|
||||
2011-04-xx - 10d3940 - lavfi 2.3.0 - avfilter.h
|
||||
2011-04-26 - 10d3940 - lavfi 2.3.0 - avfilter.h
|
||||
Add pict_type and key_frame fields to AVFilterBufferRefVideo.
|
||||
|
||||
2011-04-xx - 7a11c82 - lavfi 2.2.0 - vsrc_buffer
|
||||
2011-04-26 - 7a11c82 - lavfi 2.2.0 - vsrc_buffer
|
||||
Add sample_aspect_ratio fields to vsrc_buffer arguments
|
||||
|
||||
2011-04-21 - 94f7451 - lavc 53.1.0 - avcodec.h
|
||||
|
@ -19,7 +19,6 @@ integer.c 128bit integer math
|
||||
lls.c
|
||||
mathematics.c greatest common divisor, integer sqrt, integer log2, ...
|
||||
mem.c memory allocation routines with guaranteed alignment
|
||||
softfloat.c
|
||||
|
||||
Headers:
|
||||
bswap.h big/little/native-endian conversion code
|
||||
|
@ -180,10 +180,13 @@ should also be avoided if they don't make the code easier to understand.
|
||||
Always fill out the commit log message. Describe in a few lines what you
|
||||
changed and why. You can refer to mailing list postings if you fix a
|
||||
particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
|
||||
Recommanded format:
|
||||
area changed: Short 1 line description
|
||||
|
||||
details describing what and why and giving references.
|
||||
@item
|
||||
If you apply a patch by someone else, include the name and email address in
|
||||
the log message. Since the ffmpeg-cvslog mailing list is publicly
|
||||
archived you should add some SPAM protection to the email address. Send an
|
||||
Make sure the author of the commit is set correctly. (see git commit --author)
|
||||
If you apply a patch, send an
|
||||
answer to ffmpeg-devel (or wherever you got the patch from) saying that
|
||||
you applied the patch.
|
||||
@item
|
||||
@ -241,10 +244,10 @@ Note, these rules are mostly borrowed from the MPlayer project.
|
||||
|
||||
@section Submitting patches
|
||||
|
||||
First, (@pxref{Coding Rules}) above if you did not yet.
|
||||
First, read the (@pxref{Coding Rules}) above if you did not yet.
|
||||
|
||||
When you submit your patch, try to send a unified diff (diff '-up'
|
||||
option). We cannot read other diffs :-)
|
||||
When you submit your patch, please use @code{git format-patch} or
|
||||
@code{git send-email}. We cannot read other diffs :-)
|
||||
|
||||
Also please do not submit a patch which contains several unrelated changes.
|
||||
Split it into separate, self-contained pieces. This does not mean splitting
|
||||
@ -312,9 +315,14 @@ send a reminder by email. Your patch should eventually be dealt with.
|
||||
If it depends on a parser or a library, did you add that dependency in
|
||||
configure?
|
||||
@item
|
||||
Did you "git add" the appropriate files before committing?
|
||||
Did you @code{git add} the appropriate files before committing?
|
||||
@item
|
||||
Did you make sure it compiles standalone, i.e. with
|
||||
@code{configure --disable-everything --enable-decoder=foo}
|
||||
(or @code{--enable-demuxer} or whatever your component is)?
|
||||
@end enumerate
|
||||
|
||||
|
||||
@section patch submission checklist
|
||||
|
||||
@enumerate
|
||||
@ -382,6 +390,8 @@ send a reminder by email. Your patch should eventually be dealt with.
|
||||
@item
|
||||
Lines with similar content should be aligned vertically when doing so
|
||||
improves readability.
|
||||
@item
|
||||
Consider to add a regression test for your code.
|
||||
@end enumerate
|
||||
|
||||
@section Patch review process
|
||||
|
@ -353,4 +353,16 @@ HDCD A/D Converter
|
||||
|
||||
@end table
|
||||
|
||||
@subheading Other AC-3 Encoding Options
|
||||
|
||||
@table @option
|
||||
|
||||
@item -stereo_rematrixing @var{boolean}
|
||||
Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This
|
||||
is an optional AC-3 feature that increases quality by selectively encoding
|
||||
the left/right channels as mid/side. This option is enabled by default, and it
|
||||
is highly recommended that it be left as enabled except for testing purposes.
|
||||
|
||||
@end table
|
||||
|
||||
@c man end ENCODERS
|
||||
|
@ -72,6 +72,10 @@ integer. For example, "floor(-1.5)" is "-2.0".
|
||||
@item trunc(expr)
|
||||
Round the value of expression @var{expr} towards zero to the nearest
|
||||
integer. For example, "trunc(-1.5)" is "-1.0".
|
||||
|
||||
@item sqrt(expr)
|
||||
Compute the square root of @var{expr}. This is equivalent to
|
||||
"(@var{expr})^.5".
|
||||
@end table
|
||||
|
||||
Note that:
|
||||
|
@ -8,6 +8,7 @@ that is provided separately from the actual source distribution.
|
||||
Use the following command to get the fate test samples
|
||||
|
||||
# rsync -aL rsync://rsync.mplayerhq.hu:/samples/fate-suite/ fate/fate-suite
|
||||
# rsync -aL rsync://fate-suite.libav.org:/fate-suite/ fate-suite
|
||||
|
||||
To inform the build system about the testsuite location, pass
|
||||
`--samples=<path to the samples>` to configure or set the SAMPLES Make
|
||||
|
@ -72,7 +72,7 @@ library:
|
||||
@tab Multimedia format used by Delphine Software games.
|
||||
@item CD+G @tab @tab X
|
||||
@tab Video format used by CD+G karaoke disks
|
||||
@item Core Audio Format @tab @tab X
|
||||
@item Core Audio Format @tab X @tab X
|
||||
@tab Apple Core Audio Format
|
||||
@item CRC testing format @tab X @tab
|
||||
@item Creative Voice @tab X @tab X
|
||||
@ -677,6 +677,7 @@ following image formats are supported:
|
||||
@item Sierra VMD audio @tab @tab X
|
||||
@tab Used in Sierra VMD files.
|
||||
@item Smacker audio @tab @tab X
|
||||
@item SMPTE 302M AES3 audio @tab @tab X
|
||||
@item Sonic @tab X @tab X
|
||||
@tab experimental codec
|
||||
@item Sonic lossless @tab X @tab X
|
||||
|
@ -5,34 +5,17 @@ NOTE: This is a draft.
|
||||
|
||||
Overview:
|
||||
---------
|
||||
FFmpeg uses Roundup for tracking issues, new issues and changes to
|
||||
existing issues can be done through a web interface and through email.
|
||||
FFmpeg uses Trac for tracking issues, new issues and changes to
|
||||
existing issues can be done through a web interface.
|
||||
It is possible to subscribe to individual issues by adding yourself to the
|
||||
nosy list or to subscribe to the ffmpeg-issues mailing list which receives
|
||||
a mail for every change to every issue. Replies to such mails will also
|
||||
be properly added to the respective issue.
|
||||
(the above does all work already after light testing)
|
||||
The subscription URL for the ffmpeg-issues list is:
|
||||
http://live.polito/mailman/listinfo/ffmpeg-issues
|
||||
The subscription URL for the ffmpeg-trac list is:
|
||||
http(s)://ffmpeg.org/mailman/listinfo/ffmpeg-trac
|
||||
The URL of the webinterface of the tracker is:
|
||||
http(s)://roundup.ffmpeg/roundup/ffmpeg/
|
||||
Note the URLs in this document are obfuscated, you must append the top level
|
||||
domain for non-profit organizations to the tracker, and of Italy to the
|
||||
mailing list.
|
||||
|
||||
Email Interface:
|
||||
----------------
|
||||
There is a mailing list to which all new issues and changes to existing issues
|
||||
are sent. You can subscribe through
|
||||
http://live.polito/mailman/listinfo/ffmpeg-issues
|
||||
Replies to messages there will have their text added to the specific issues.
|
||||
Attachments will be added as if they had been uploaded via the web interface.
|
||||
You can change the status, substatus, topic, ... by changing the subject in
|
||||
your reply like:
|
||||
Re: [issue94] register_avcodec and allcodecs.h [type=patch;status=open;substatus=approved]
|
||||
Roundup will then change things as you requested and remove the [...] from
|
||||
the subject before forwarding the mail to the mailing list.
|
||||
|
||||
http(s)://ffmpeg.org/trac/ffmpeg
|
||||
|
||||
NOTE: issue = (bug report || patch || feature request)
|
||||
|
||||
|
279
ffmpeg.c
279
ffmpeg.c
@ -19,9 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* needed for usleep() */
|
||||
#define _XOPEN_SOURCE 600
|
||||
|
||||
#include "config.h"
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
@ -50,6 +47,7 @@
|
||||
#include "libavformat/ffm.h" // not public API
|
||||
|
||||
#if CONFIG_AVFILTER
|
||||
# include "libavfilter/avcodec.h"
|
||||
# include "libavfilter/avfilter.h"
|
||||
# include "libavfilter/avfiltergraph.h"
|
||||
# include "libavfilter/vsrc_buffer.h"
|
||||
@ -195,6 +193,10 @@ static char *subtitle_codec_name = NULL;
|
||||
static char *subtitle_language = NULL;
|
||||
static unsigned int subtitle_codec_tag = 0;
|
||||
|
||||
static int data_disable = 0;
|
||||
static char *data_codec_name = NULL;
|
||||
static unsigned int data_codec_tag = 0;
|
||||
|
||||
static float mux_preload= 0.5;
|
||||
static float mux_max_delay= 0.7;
|
||||
|
||||
@ -213,11 +215,12 @@ static const char *pass_logfilename_prefix;
|
||||
static int audio_stream_copy = 0;
|
||||
static int video_stream_copy = 0;
|
||||
static int subtitle_stream_copy = 0;
|
||||
static int data_stream_copy = 0;
|
||||
static int video_sync_method= -1;
|
||||
static int audio_sync_method= 0;
|
||||
static float audio_drift_threshold= 0.1;
|
||||
static int copy_ts= 0;
|
||||
static int copy_tb;
|
||||
static int copy_tb= 0;
|
||||
static int opt_shortest = 0;
|
||||
static int video_global_header = 0;
|
||||
static char *vstats_filename;
|
||||
@ -281,14 +284,13 @@ typedef struct AVOutputStream {
|
||||
AVBitStreamFilterContext *bitstream_filters;
|
||||
/* video only */
|
||||
int video_resample;
|
||||
AVFrame pict_tmp; /* temporary image for resampling */
|
||||
AVFrame resample_frame; /* temporary frame for image resampling */
|
||||
struct SwsContext *img_resample_ctx; /* for image resampling */
|
||||
int resample_height;
|
||||
int resample_width;
|
||||
int resample_pix_fmt;
|
||||
|
||||
float frame_aspect_ratio;
|
||||
|
||||
/* forced key frames */
|
||||
int64_t *forced_kf_pts;
|
||||
int forced_kf_count;
|
||||
@ -312,6 +314,8 @@ typedef struct AVOutputStream {
|
||||
char *avfilter;
|
||||
AVFilterGraph *graph;
|
||||
#endif
|
||||
|
||||
int sws_flags;
|
||||
} AVOutputStream;
|
||||
|
||||
static AVOutputStream **output_streams_for_file[MAX_FILES] = { NULL };
|
||||
@ -389,7 +393,7 @@ static int configure_video_filters(AVInputStream *ist, AVOutputStream *ost)
|
||||
snprintf(args, 255, "%d:%d:flags=0x%X",
|
||||
codec->width,
|
||||
codec->height,
|
||||
(int)av_get_int(sws_opts, "sws_flags", NULL));
|
||||
ost->sws_flags);
|
||||
if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
|
||||
NULL, args, NULL, ost->graph)) < 0)
|
||||
return ret;
|
||||
@ -398,7 +402,7 @@ static int configure_video_filters(AVInputStream *ist, AVOutputStream *ost)
|
||||
last_filter = filter;
|
||||
}
|
||||
|
||||
snprintf(args, sizeof(args), "flags=0x%X", (int)av_get_int(sws_opts, "sws_flags", NULL));
|
||||
snprintf(args, sizeof(args), "flags=0x%X", ost->sws_flags);
|
||||
ost->graph->scale_sws_opts = av_strdup(args);
|
||||
|
||||
if (ost->avfilter) {
|
||||
@ -557,6 +561,7 @@ static int ffmpeg_exit(int ret)
|
||||
av_free(video_codec_name);
|
||||
av_free(audio_codec_name);
|
||||
av_free(subtitle_codec_name);
|
||||
av_free(data_codec_name);
|
||||
|
||||
av_free(video_standard);
|
||||
|
||||
@ -657,11 +662,11 @@ static void choose_pixel_fmt(AVStream *st, AVCodec *codec)
|
||||
}
|
||||
if (*p == -1) {
|
||||
if(st->codec->pix_fmt != PIX_FMT_NONE)
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
|
||||
av_pix_fmt_descriptors[st->codec->pix_fmt].name,
|
||||
codec->name,
|
||||
av_pix_fmt_descriptors[codec->pix_fmts[0]].name);
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
|
||||
av_pix_fmt_descriptors[st->codec->pix_fmt].name,
|
||||
codec->name,
|
||||
av_pix_fmt_descriptors[codec->pix_fmts[0]].name);
|
||||
st->codec->pix_fmt = codec->pix_fmts[0];
|
||||
}
|
||||
}
|
||||
@ -685,6 +690,8 @@ static AVOutputStream *new_output_stream(AVFormatContext *oc, int file_idx)
|
||||
}
|
||||
ost->file_index = file_idx;
|
||||
ost->index = idx;
|
||||
|
||||
ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
|
||||
return ost;
|
||||
}
|
||||
|
||||
@ -1141,8 +1148,8 @@ static void do_video_out(AVFormatContext *s,
|
||||
AVFrame *in_picture,
|
||||
int *frame_size)
|
||||
{
|
||||
int nb_frames, i, ret, resample_changed;
|
||||
AVFrame *final_picture, *formatted_picture, *resampling_dst;
|
||||
int nb_frames, i, ret, av_unused resample_changed;
|
||||
AVFrame *final_picture, *formatted_picture;
|
||||
AVCodecContext *enc, *dec;
|
||||
double sync_ipts;
|
||||
|
||||
@ -1187,8 +1194,8 @@ static void do_video_out(AVFormatContext *s,
|
||||
|
||||
formatted_picture = in_picture;
|
||||
final_picture = formatted_picture;
|
||||
resampling_dst = &ost->pict_tmp;
|
||||
|
||||
#if !CONFIG_AVFILTER
|
||||
resample_changed = ost->resample_width != dec->width ||
|
||||
ost->resample_height != dec->height ||
|
||||
ost->resample_pix_fmt != dec->pix_fmt;
|
||||
@ -1199,32 +1206,39 @@ static void do_video_out(AVFormatContext *s,
|
||||
ist->file_index, ist->index,
|
||||
ost->resample_width, ost->resample_height, avcodec_get_pix_fmt_name(ost->resample_pix_fmt),
|
||||
dec->width , dec->height , avcodec_get_pix_fmt_name(dec->pix_fmt));
|
||||
if(!ost->video_resample)
|
||||
ffmpeg_exit(1);
|
||||
ost->resample_width = dec->width;
|
||||
ost->resample_height = dec->height;
|
||||
ost->resample_pix_fmt = dec->pix_fmt;
|
||||
}
|
||||
|
||||
#if !CONFIG_AVFILTER
|
||||
ost->video_resample = dec->width != enc->width ||
|
||||
dec->height != enc->height ||
|
||||
dec->pix_fmt != enc->pix_fmt;
|
||||
|
||||
if (ost->video_resample) {
|
||||
final_picture = &ost->pict_tmp;
|
||||
if (resample_changed) {
|
||||
final_picture = &ost->resample_frame;
|
||||
if (!ost->img_resample_ctx || resample_changed) {
|
||||
/* initialize the destination picture */
|
||||
if (!ost->resample_frame.data[0]) {
|
||||
avcodec_get_frame_defaults(&ost->resample_frame);
|
||||
if (avpicture_alloc((AVPicture *)&ost->resample_frame, enc->pix_fmt,
|
||||
enc->width, enc->height)) {
|
||||
fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n");
|
||||
ffmpeg_exit(1);
|
||||
}
|
||||
}
|
||||
/* initialize a new scaler context */
|
||||
sws_freeContext(ost->img_resample_ctx);
|
||||
sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
|
||||
ost->img_resample_ctx = sws_getContext(
|
||||
ist->st->codec->width,
|
||||
ist->st->codec->height,
|
||||
ist->st->codec->pix_fmt,
|
||||
ost->st->codec->width,
|
||||
ost->st->codec->height,
|
||||
ost->st->codec->pix_fmt,
|
||||
sws_flags, NULL, NULL, NULL);
|
||||
ost->img_resample_ctx = sws_getContext(dec->width, dec->height, dec->pix_fmt,
|
||||
enc->width, enc->height, enc->pix_fmt,
|
||||
ost->sws_flags, NULL, NULL, NULL);
|
||||
if (ost->img_resample_ctx == NULL) {
|
||||
fprintf(stderr, "Cannot get resampling context\n");
|
||||
ffmpeg_exit(1);
|
||||
}
|
||||
}
|
||||
sws_scale(ost->img_resample_ctx, formatted_picture->data, formatted_picture->linesize,
|
||||
0, ost->resample_height, resampling_dst->data, resampling_dst->linesize);
|
||||
0, ost->resample_height, ost->resample_frame.data, ost->resample_frame.linesize);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1254,7 +1268,7 @@ static void do_video_out(AVFormatContext *s,
|
||||
/* better than nothing: use input picture interlaced
|
||||
settings */
|
||||
big_picture.interlaced_frame = in_picture->interlaced_frame;
|
||||
if(avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){
|
||||
if (ost->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) {
|
||||
if(top_field_first == -1)
|
||||
big_picture.top_field_first = in_picture->top_field_first;
|
||||
else
|
||||
@ -1272,7 +1286,7 @@ static void do_video_out(AVFormatContext *s,
|
||||
//av_log(NULL, AV_LOG_DEBUG, "%"PRId64" -> encoder\n", ost->sync_opts);
|
||||
if (ost->forced_kf_index < ost->forced_kf_count &&
|
||||
big_picture.pts >= ost->forced_kf_pts[ost->forced_kf_index]) {
|
||||
big_picture.pict_type = FF_I_TYPE;
|
||||
big_picture.pict_type = AV_PICTURE_TYPE_I;
|
||||
ost->forced_kf_index++;
|
||||
}
|
||||
ret = avcodec_encode_video(enc,
|
||||
@ -1347,7 +1361,7 @@ static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
|
||||
avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0;
|
||||
fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
|
||||
(double)video_size / 1024, ti1, bitrate, avg_bitrate);
|
||||
fprintf(vstats_file,"type= %c\n", av_get_pict_type_char(enc->coded_frame->pict_type));
|
||||
fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1389,11 +1403,11 @@ static void print_report(AVFormatContext **output_files,
|
||||
ti1 = 1e10;
|
||||
vid = 0;
|
||||
for(i=0;i<nb_ostreams;i++) {
|
||||
float q= -1;
|
||||
float q = -1;
|
||||
ost = ost_table[i];
|
||||
enc = ost->st->codec;
|
||||
if(!ost->st->stream_copy && enc->coded_frame)
|
||||
q= enc->coded_frame->quality/(float)FF_QP2LAMBDA;
|
||||
if (!ost->st->stream_copy && enc->coded_frame)
|
||||
q = enc->coded_frame->quality/(float)FF_QP2LAMBDA;
|
||||
if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q);
|
||||
}
|
||||
@ -1407,7 +1421,7 @@ static void print_report(AVFormatContext **output_files,
|
||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L");
|
||||
if(qp_hist){
|
||||
int j;
|
||||
int qp= lrintf(q);
|
||||
int qp = lrintf(q);
|
||||
if(qp>=0 && qp<FF_ARRAY_ELEMS(qp_histogram))
|
||||
qp_histogram[qp]++;
|
||||
for(j=0; j<32; j++)
|
||||
@ -1489,7 +1503,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
|
||||
AVFormatContext *os;
|
||||
AVOutputStream *ost;
|
||||
int ret, i;
|
||||
int got_picture;
|
||||
int got_output;
|
||||
AVFrame picture;
|
||||
void *buffer_to_free = NULL;
|
||||
static unsigned int samples_size= 0;
|
||||
@ -1521,7 +1535,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
|
||||
pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
|
||||
|
||||
//while we have more to decode or while the decoder did output something on EOF
|
||||
while (avpkt.size > 0 || (!pkt && ist->next_pts != ist->pts)) {
|
||||
while (avpkt.size > 0 || (!pkt && got_output)) {
|
||||
uint8_t *data_buf, *decoded_data_buf;
|
||||
int data_size, decoded_data_size;
|
||||
handle_eof:
|
||||
@ -1557,9 +1571,10 @@ static int output_packet(AVInputStream *ist, int ist_index,
|
||||
avpkt.data += ret;
|
||||
avpkt.size -= ret;
|
||||
data_size = ret;
|
||||
got_output = decoded_data_size > 0;
|
||||
/* Some bug in mpeg audio decoder gives */
|
||||
/* decoded_data_size < 0, it seems they are overflows */
|
||||
if (decoded_data_size <= 0) {
|
||||
if (!got_output) {
|
||||
/* no audio frame */
|
||||
continue;
|
||||
}
|
||||
@ -1576,11 +1591,11 @@ static int output_packet(AVInputStream *ist, int ist_index,
|
||||
pkt_pts = AV_NOPTS_VALUE;
|
||||
|
||||
ret = avcodec_decode_video2(ist->st->codec,
|
||||
&picture, &got_picture, &avpkt);
|
||||
&picture, &got_output, &avpkt);
|
||||
ist->st->quality= picture.quality;
|
||||
if (ret < 0)
|
||||
goto fail_decode;
|
||||
if (!got_picture) {
|
||||
if (!got_output) {
|
||||
/* no picture yet */
|
||||
goto discard_packet;
|
||||
}
|
||||
@ -1597,10 +1612,10 @@ static int output_packet(AVInputStream *ist, int ist_index,
|
||||
break;
|
||||
case AVMEDIA_TYPE_SUBTITLE:
|
||||
ret = avcodec_decode_subtitle2(ist->st->codec,
|
||||
&subtitle, &got_picture, &avpkt);
|
||||
&subtitle, &got_output, &avpkt);
|
||||
if (ret < 0)
|
||||
goto fail_decode;
|
||||
if (!got_picture) {
|
||||
if (!got_output) {
|
||||
goto discard_packet;
|
||||
}
|
||||
subtitle_to_free = &subtitle;
|
||||
@ -1633,14 +1648,11 @@ static int output_packet(AVInputStream *ist, int ist_index,
|
||||
for(i=0;i<nb_ostreams;i++) {
|
||||
ost = ost_table[i];
|
||||
if (ost->input_video_filter && ost->source_index == ist_index) {
|
||||
AVRational sar;
|
||||
if (ist->st->sample_aspect_ratio.num) sar = ist->st->sample_aspect_ratio;
|
||||
else sar = ist->st->codec->sample_aspect_ratio;
|
||||
if (!picture.sample_aspect_ratio.num)
|
||||
picture.sample_aspect_ratio = ist->st->sample_aspect_ratio;
|
||||
picture.pts = ist->pts;
|
||||
// add it to be filtered
|
||||
av_vsrc_buffer_add_frame2(ost->input_video_filter, &picture,
|
||||
ist->pts,
|
||||
sar, ist->st->codec->width, ist->st->codec->height,
|
||||
ist->st->codec->pix_fmt, ""); //TODO user setable params
|
||||
av_vsrc_buffer_add_frame2(ost->input_video_filter, &picture, ""); //TODO user setable params
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1699,7 +1711,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
#if CONFIG_AVFILTER
|
||||
if (ost->picref->video && !ost->frame_aspect_ratio)
|
||||
ost->st->codec->sample_aspect_ratio = ost->picref->video->pixel_aspect;
|
||||
ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio;
|
||||
#endif
|
||||
do_video_out(os, ost, ist, &picture, &frame_size);
|
||||
if (vstats_filename && frame_size)
|
||||
@ -2257,6 +2269,8 @@ static int transcode(AVFormatContext **output_files,
|
||||
codec->width = icodec->width;
|
||||
codec->height = icodec->height;
|
||||
break;
|
||||
case AVMEDIA_TYPE_DATA:
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
@ -2284,27 +2298,6 @@ static int transcode(AVFormatContext **output_files,
|
||||
codec->height != icodec->height ||
|
||||
codec->pix_fmt != icodec->pix_fmt;
|
||||
if (ost->video_resample) {
|
||||
#if !CONFIG_AVFILTER
|
||||
avcodec_get_frame_defaults(&ost->pict_tmp);
|
||||
if(avpicture_alloc((AVPicture*)&ost->pict_tmp, codec->pix_fmt,
|
||||
codec->width, codec->height)) {
|
||||
fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n");
|
||||
ffmpeg_exit(1);
|
||||
}
|
||||
sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
|
||||
ost->img_resample_ctx = sws_getContext(
|
||||
icodec->width,
|
||||
icodec->height,
|
||||
icodec->pix_fmt,
|
||||
codec->width,
|
||||
codec->height,
|
||||
codec->pix_fmt,
|
||||
sws_flags, NULL, NULL, NULL);
|
||||
if (ost->img_resample_ctx == NULL) {
|
||||
fprintf(stderr, "Cannot get resampling context\n");
|
||||
ffmpeg_exit(1);
|
||||
}
|
||||
#endif
|
||||
codec->bits_per_raw_sample= frame_bits_per_raw_sample;
|
||||
}
|
||||
ost->resample_height = icodec->height;
|
||||
@ -2576,7 +2569,7 @@ static int transcode(AVFormatContext **output_files,
|
||||
|
||||
if (!using_stdin) {
|
||||
if(verbose >= 0)
|
||||
fprintf(stderr, "Press [q] to stop encoding\n");
|
||||
fprintf(stderr, "Press [q] to stop, [?] for help\n");
|
||||
avio_set_interrupt_cb(decode_interrupt_cb);
|
||||
}
|
||||
term_init();
|
||||
@ -2600,6 +2593,50 @@ static int transcode(AVFormatContext **output_files,
|
||||
key = read_key();
|
||||
if (key == 'q')
|
||||
break;
|
||||
if (key == '+') verbose++;
|
||||
if (key == '-') verbose--;
|
||||
if (key == 's') qp_hist ^= 1;
|
||||
if (key == 'h'){
|
||||
if (do_hex_dump){
|
||||
do_hex_dump = do_pkt_dump = 0;
|
||||
} else if(do_pkt_dump){
|
||||
do_hex_dump = 1;
|
||||
} else
|
||||
do_pkt_dump = 1;
|
||||
av_log_set_level(AV_LOG_DEBUG);
|
||||
}
|
||||
if (key == 'd' || key == 'D'){
|
||||
int debug=0;
|
||||
if(key == 'D') {
|
||||
ist = ist_table[0];
|
||||
debug = ist->st->codec->debug<<1;
|
||||
if(!debug) debug = 1;
|
||||
while(debug & (FF_DEBUG_DCT_COEFF|FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) //unsupported, would just crash
|
||||
debug += debug;
|
||||
}else
|
||||
scanf("%d", &debug);
|
||||
for(i=0;i<nb_istreams;i++) {
|
||||
ist = ist_table[i];
|
||||
ist->st->codec->debug = debug;
|
||||
}
|
||||
for(i=0;i<nb_ostreams;i++) {
|
||||
ost = ost_table[i];
|
||||
ost->st->codec->debug = debug;
|
||||
}
|
||||
if(debug) av_log_set_level(AV_LOG_DEBUG);
|
||||
fprintf(stderr,"debug=%d\n", debug);
|
||||
}
|
||||
if (key == '?'){
|
||||
fprintf(stderr, "key function\n"
|
||||
"? show this help\n"
|
||||
"+ increase verbosity\n"
|
||||
"- decrease verbosity\n"
|
||||
"D cycle through available debug modes\n"
|
||||
"h dump packets/hex press to cycle through the 3 states\n"
|
||||
"q quit\n"
|
||||
"s Show QP histogram\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* select the stream that we must read now by looking at the
|
||||
@ -2706,7 +2743,11 @@ static int transcode(AVFormatContext **output_files,
|
||||
|
||||
/* finish if recording time exhausted */
|
||||
if (recording_time != INT64_MAX &&
|
||||
av_compare_ts(pkt.pts, ist->st->time_base, recording_time + start_time, (AVRational){1, 1000000}) >= 0) {
|
||||
(pkt.pts != AV_NOPTS_VALUE || pkt.dts != AV_NOPTS_VALUE ?
|
||||
av_compare_ts(pkt.pts, ist->st->time_base, recording_time + start_time, (AVRational){1, 1000000})
|
||||
:
|
||||
av_compare_ts(ist->pts, AV_TIME_BASE_Q, recording_time + start_time, (AVRational){1, 1000000})
|
||||
)>= 0) {
|
||||
ist->is_past_recording_time = 1;
|
||||
goto discard_packet;
|
||||
}
|
||||
@ -2796,7 +2837,7 @@ static int transcode(AVFormatContext **output_files,
|
||||
av_fifo_free(ost->fifo); /* works even if fifo is not
|
||||
initialized but set to zero */
|
||||
av_freep(&ost->st->codec->subtitle_header);
|
||||
av_free(ost->pict_tmp.data[0]);
|
||||
av_free(ost->resample_frame.data[0]);
|
||||
av_free(ost->forced_kf_pts);
|
||||
if (ost->video_resample)
|
||||
sws_freeContext(ost->img_resample_ctx);
|
||||
@ -3019,6 +3060,11 @@ static void opt_subtitle_codec(const char *arg)
|
||||
opt_codec(&subtitle_stream_copy, &subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, arg);
|
||||
}
|
||||
|
||||
static void opt_data_codec(const char *arg)
|
||||
{
|
||||
opt_codec(&data_stream_copy, &data_codec_name, AVMEDIA_TYPE_DATA, arg);
|
||||
}
|
||||
|
||||
static int opt_codec_tag(const char *opt, const char *arg)
|
||||
{
|
||||
char *tail;
|
||||
@ -3410,17 +3456,23 @@ static void opt_input_file(const char *filename)
|
||||
av_freep(&video_codec_name);
|
||||
av_freep(&audio_codec_name);
|
||||
av_freep(&subtitle_codec_name);
|
||||
uninit_opts();
|
||||
init_opts();
|
||||
}
|
||||
|
||||
static void check_audio_video_sub_inputs(int *has_video_ptr, int *has_audio_ptr,
|
||||
int *has_subtitle_ptr)
|
||||
static void check_inputs(int *has_video_ptr,
|
||||
int *has_audio_ptr,
|
||||
int *has_subtitle_ptr,
|
||||
int *has_data_ptr)
|
||||
{
|
||||
int has_video, has_audio, has_subtitle, i, j;
|
||||
int has_video, has_audio, has_subtitle, has_data, i, j;
|
||||
AVFormatContext *ic;
|
||||
|
||||
has_video = 0;
|
||||
has_audio = 0;
|
||||
has_subtitle = 0;
|
||||
has_data = 0;
|
||||
|
||||
for(j=0;j<nb_input_files;j++) {
|
||||
ic = input_files[j];
|
||||
for(i=0;i<ic->nb_streams;i++) {
|
||||
@ -3438,6 +3490,7 @@ static void check_audio_video_sub_inputs(int *has_video_ptr, int *has_audio_ptr,
|
||||
case AVMEDIA_TYPE_DATA:
|
||||
case AVMEDIA_TYPE_ATTACHMENT:
|
||||
case AVMEDIA_TYPE_UNKNOWN:
|
||||
has_data = 1;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
@ -3447,6 +3500,7 @@ static void check_audio_video_sub_inputs(int *has_video_ptr, int *has_audio_ptr,
|
||||
*has_video_ptr = has_video;
|
||||
*has_audio_ptr = has_audio;
|
||||
*has_subtitle_ptr = has_subtitle;
|
||||
*has_data_ptr = has_data;
|
||||
}
|
||||
|
||||
static void new_video_stream(AVFormatContext *oc, int file_idx)
|
||||
@ -3679,6 +3733,45 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx)
|
||||
audio_stream_copy = 0;
|
||||
}
|
||||
|
||||
static void new_data_stream(AVFormatContext *oc, int file_idx)
|
||||
{
|
||||
AVStream *st;
|
||||
AVOutputStream *ost;
|
||||
AVCodec *codec=NULL;
|
||||
AVCodecContext *data_enc;
|
||||
|
||||
st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
|
||||
if (!st) {
|
||||
fprintf(stderr, "Could not alloc stream\n");
|
||||
ffmpeg_exit(1);
|
||||
}
|
||||
ost = new_output_stream(oc, file_idx);
|
||||
data_enc = st->codec;
|
||||
output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
|
||||
if (!data_stream_copy) {
|
||||
fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\n");
|
||||
ffmpeg_exit(1);
|
||||
}
|
||||
avcodec_get_context_defaults3(st->codec, codec);
|
||||
|
||||
data_enc->codec_type = AVMEDIA_TYPE_DATA;
|
||||
|
||||
if (data_codec_tag)
|
||||
data_enc->codec_tag= data_codec_tag;
|
||||
|
||||
if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
|
||||
data_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||
avcodec_opts[AVMEDIA_TYPE_DATA]->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||
}
|
||||
if (data_stream_copy) {
|
||||
st->stream_copy = 1;
|
||||
}
|
||||
|
||||
data_disable = 0;
|
||||
av_freep(&data_codec_name);
|
||||
data_stream_copy = 0;
|
||||
}
|
||||
|
||||
static void new_subtitle_stream(AVFormatContext *oc, int file_idx)
|
||||
{
|
||||
AVStream *st;
|
||||
@ -3749,6 +3842,7 @@ static int opt_new_stream(const char *opt, const char *arg)
|
||||
if (!strcmp(opt, "newvideo" )) new_video_stream (oc, file_idx);
|
||||
else if (!strcmp(opt, "newaudio" )) new_audio_stream (oc, file_idx);
|
||||
else if (!strcmp(opt, "newsubtitle")) new_subtitle_stream(oc, file_idx);
|
||||
else if (!strcmp(opt, "newdata" )) new_data_stream (oc, file_idx);
|
||||
else av_assert0(0);
|
||||
return 0;
|
||||
}
|
||||
@ -3760,8 +3854,7 @@ static int opt_streamid(const char *opt, const char *arg)
|
||||
char *p;
|
||||
char idx_str[16];
|
||||
|
||||
strncpy(idx_str, arg, sizeof(idx_str));
|
||||
idx_str[sizeof(idx_str)-1] = '\0';
|
||||
av_strlcpy(idx_str, arg, sizeof(idx_str));
|
||||
p = strchr(idx_str, ':');
|
||||
if (!p) {
|
||||
fprintf(stderr,
|
||||
@ -3779,8 +3872,8 @@ static int opt_streamid(const char *opt, const char *arg)
|
||||
static void opt_output_file(const char *filename)
|
||||
{
|
||||
AVFormatContext *oc;
|
||||
int err, use_video, use_audio, use_subtitle;
|
||||
int input_has_video, input_has_audio, input_has_subtitle;
|
||||
int err, use_video, use_audio, use_subtitle, use_data;
|
||||
int input_has_video, input_has_audio, input_has_subtitle, input_has_data;
|
||||
AVFormatParameters params, *ap = ¶ms;
|
||||
AVOutputFormat *file_oformat;
|
||||
|
||||
@ -3808,28 +3901,36 @@ static void opt_output_file(const char *filename)
|
||||
use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name;
|
||||
use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name;
|
||||
use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name;
|
||||
use_data = data_stream_copy || data_codec_name; /* XXX once generic data codec will be available add a ->data_codec reference and use it here */
|
||||
|
||||
/* disable if no corresponding type found and at least one
|
||||
input file */
|
||||
if (nb_input_files > 0) {
|
||||
check_audio_video_sub_inputs(&input_has_video, &input_has_audio,
|
||||
&input_has_subtitle);
|
||||
check_inputs(&input_has_video,
|
||||
&input_has_audio,
|
||||
&input_has_subtitle,
|
||||
&input_has_data);
|
||||
|
||||
if (!input_has_video)
|
||||
use_video = 0;
|
||||
if (!input_has_audio)
|
||||
use_audio = 0;
|
||||
if (!input_has_subtitle)
|
||||
use_subtitle = 0;
|
||||
if (!input_has_data)
|
||||
use_data = 0;
|
||||
}
|
||||
|
||||
/* manual disable */
|
||||
if (audio_disable) use_audio = 0;
|
||||
if (video_disable) use_video = 0;
|
||||
if (subtitle_disable) use_subtitle = 0;
|
||||
if (data_disable) use_data = 0;
|
||||
|
||||
if (use_video) new_video_stream(oc, nb_output_files);
|
||||
if (use_audio) new_audio_stream(oc, nb_output_files);
|
||||
if (use_subtitle) new_subtitle_stream(oc, nb_output_files);
|
||||
if (use_data) new_data_stream(oc, nb_output_files);
|
||||
|
||||
oc->timestamp = recording_timestamp;
|
||||
|
||||
@ -3890,6 +3991,8 @@ static void opt_output_file(const char *filename)
|
||||
set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL);
|
||||
|
||||
av_freep(&forced_key_frames);
|
||||
uninit_opts();
|
||||
init_opts();
|
||||
}
|
||||
|
||||
/* same option as mencoder */
|
||||
@ -4239,6 +4342,8 @@ static int opt_preset(const char *opt, const char *arg)
|
||||
opt_video_codec(tmp2);
|
||||
}else if(!strcmp(tmp, "scodec")){
|
||||
opt_subtitle_codec(tmp2);
|
||||
}else if(!strcmp(tmp, "dcodec")){
|
||||
opt_data_codec(tmp2);
|
||||
}else if(opt_default(tmp, tmp2) < 0){
|
||||
fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2);
|
||||
ffmpeg_exit(1);
|
||||
@ -4392,6 +4497,8 @@ static const OptionDef options[] = {
|
||||
{ "vpre", OPT_FUNC2 | HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_preset}, "set the video options to the indicated preset", "preset" },
|
||||
{ "spre", OPT_FUNC2 | HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_preset}, "set the subtitle options to the indicated preset", "preset" },
|
||||
{ "fpre", OPT_FUNC2 | HAS_ARG | OPT_EXPERT, {(void*)opt_preset}, "set options from indicated preset file", "filename" },
|
||||
/* data codec support */
|
||||
{ "dcodec", HAS_ARG | OPT_DATA, {(void*)opt_data_codec}, "force data codec ('copy' to copy stream)", "codec" },
|
||||
|
||||
{ "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
|
||||
{ NULL, },
|
||||
|
43
ffplay.c
43
ffplay.c
@ -19,8 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#define _XOPEN_SOURCE 600
|
||||
|
||||
#include "config.h"
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
@ -40,6 +38,7 @@
|
||||
#include "libavcodec/avfft.h"
|
||||
|
||||
#if CONFIG_AVFILTER
|
||||
# include "libavfilter/avcodec.h"
|
||||
# include "libavfilter/avfilter.h"
|
||||
# include "libavfilter/avfiltergraph.h"
|
||||
#endif
|
||||
@ -692,10 +691,10 @@ static void video_image_display(VideoState *is)
|
||||
vp = &is->pictq[is->pictq_rindex];
|
||||
if (vp->bmp) {
|
||||
#if CONFIG_AVFILTER
|
||||
if (vp->picref->video->pixel_aspect.num == 0)
|
||||
if (vp->picref->video->sample_aspect_ratio.num == 0)
|
||||
aspect_ratio = 0;
|
||||
else
|
||||
aspect_ratio = av_q2d(vp->picref->video->pixel_aspect);
|
||||
aspect_ratio = av_q2d(vp->picref->video->sample_aspect_ratio);
|
||||
#else
|
||||
|
||||
/* XXX: use variable in the frame */
|
||||
@ -1381,7 +1380,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
|
||||
|
||||
#if defined(DEBUG_SYNC) && 0
|
||||
printf("frame_type=%c clock=%0.3f pts=%0.3f\n",
|
||||
av_get_pict_type_char(src_frame->pict_type), pts, pts1);
|
||||
av_get_picture_type_char(src_frame->pict_type), pts, pts1);
|
||||
#endif
|
||||
|
||||
/* wait until we have space to put a new picture */
|
||||
@ -1644,7 +1643,7 @@ static int input_init(AVFilterContext *ctx, const char *args, void *opaque)
|
||||
codec->opaque = ctx;
|
||||
if((codec->codec->capabilities & CODEC_CAP_DR1)
|
||||
) {
|
||||
codec->flags |= CODEC_FLAG_EMU_EDGE;
|
||||
av_assert0(codec->flags & CODEC_FLAG_EMU_EDGE);
|
||||
priv->use_dr1 = 1;
|
||||
codec->get_buffer = input_get_buffer;
|
||||
codec->release_buffer = input_release_buffer;
|
||||
@ -1686,9 +1685,9 @@ static int input_request_frame(AVFilterLink *link)
|
||||
}
|
||||
av_free_packet(&pkt);
|
||||
|
||||
avfilter_copy_frame_props(picref, priv->frame);
|
||||
picref->pts = pts;
|
||||
picref->pos = pkt.pos;
|
||||
picref->video->pixel_aspect = priv->is->video_st->codec->sample_aspect_ratio;
|
||||
|
||||
avfilter_start_frame(link, picref);
|
||||
avfilter_draw_slice(link, 0, link->h, 1);
|
||||
avfilter_end_frame(link);
|
||||
@ -1831,6 +1830,7 @@ static int video_thread(void *arg)
|
||||
#else
|
||||
ret = get_video_frame(is, frame, &pts_int, &pkt);
|
||||
pos = pkt.pos;
|
||||
av_free_packet(&pkt);
|
||||
#endif
|
||||
|
||||
if (ret < 0) goto the_end;
|
||||
@ -1841,9 +1841,7 @@ static int video_thread(void *arg)
|
||||
pts = pts_int*av_q2d(is->video_st->time_base);
|
||||
|
||||
ret = queue_picture(is, frame, pts, pos);
|
||||
#if !CONFIG_AVFILTER
|
||||
av_free_packet(&pkt);
|
||||
#endif
|
||||
|
||||
if (ret < 0)
|
||||
goto the_end;
|
||||
|
||||
@ -1937,9 +1935,7 @@ static int subtitle_thread(void *arg)
|
||||
/* copy samples for viewing in editor window */
|
||||
static void update_sample_display(VideoState *is, short *samples, int samples_size)
|
||||
{
|
||||
int size, len, channels;
|
||||
|
||||
channels = is->audio_st->codec->channels;
|
||||
int size, len;
|
||||
|
||||
size = samples_size / sizeof(short);
|
||||
while (size > 0) {
|
||||
@ -2193,6 +2189,9 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
}
|
||||
|
||||
codec = avcodec_find_decoder(avctx->codec_id);
|
||||
if (!codec)
|
||||
return -1;
|
||||
|
||||
avctx->debug_mv = debug_mv;
|
||||
avctx->debug = debug;
|
||||
avctx->workaround_bugs = workaround_bugs;
|
||||
@ -2209,8 +2208,10 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
|
||||
set_context_opts(avctx, avcodec_opts[avctx->codec_type], 0, codec);
|
||||
|
||||
if (!codec ||
|
||||
avcodec_open(avctx, codec) < 0)
|
||||
if(codec->capabilities & CODEC_CAP_DR1)
|
||||
avctx->flags |= CODEC_FLAG_EMU_EDGE;
|
||||
|
||||
if (avcodec_open(avctx, codec) < 0)
|
||||
return -1;
|
||||
|
||||
/* prepare audio output */
|
||||
@ -2381,10 +2382,18 @@ static int read_thread(void *arg)
|
||||
ap->height= frame_height;
|
||||
ap->time_base= (AVRational){1, 25};
|
||||
ap->pix_fmt = frame_pix_fmt;
|
||||
ic->flags |= AVFMT_FLAG_PRIV_OPT;
|
||||
|
||||
set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM, NULL);
|
||||
|
||||
err = av_open_input_file(&ic, is->filename, is->iformat, 0, ap);
|
||||
if (err >= 0) {
|
||||
set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM, NULL);
|
||||
err = av_demuxer_open(ic, ap);
|
||||
if(err < 0){
|
||||
avformat_free_context(ic);
|
||||
ic= NULL;
|
||||
}
|
||||
}
|
||||
if (err < 0) {
|
||||
print_error(is->filename, err);
|
||||
ret = -1;
|
||||
|
@ -19,8 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#define _XOPEN_SOURCE 600
|
||||
|
||||
#include "config.h"
|
||||
#if !HAVE_CLOSESOCKET
|
||||
#define closesocket close
|
||||
|
@ -780,11 +780,11 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
if(frame_4cc == AV_RL32("ifr2")){
|
||||
p->pict_type= FF_I_TYPE;
|
||||
p->pict_type= AV_PICTURE_TYPE_I;
|
||||
if(decode_i2_frame(f, buf-4, frame_size) < 0)
|
||||
return -1;
|
||||
}else if(frame_4cc == AV_RL32("ifrm")){
|
||||
p->pict_type= FF_I_TYPE;
|
||||
p->pict_type= AV_PICTURE_TYPE_I;
|
||||
if(decode_i_frame(f, buf, frame_size) < 0)
|
||||
return -1;
|
||||
}else if(frame_4cc == AV_RL32("pfrm") || frame_4cc == AV_RL32("pfr2")){
|
||||
@ -796,7 +796,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
}
|
||||
|
||||
p->pict_type= FF_P_TYPE;
|
||||
p->pict_type= AV_PICTURE_TYPE_P;
|
||||
if(decode_p_frame(f, buf, frame_size) < 0)
|
||||
return -1;
|
||||
}else if(frame_4cc == AV_RL32("snd_")){
|
||||
@ -805,7 +805,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
av_log(avctx, AV_LOG_ERROR, "ignoring unknown chunk length:%d\n", buf_size);
|
||||
}
|
||||
|
||||
p->key_frame= p->pict_type == FF_I_TYPE;
|
||||
p->key_frame= p->pict_type == AV_PICTURE_TYPE_I;
|
||||
|
||||
*picture= *p;
|
||||
*data_size = sizeof(AVPicture);
|
||||
@ -832,6 +832,8 @@ static av_cold int decode_init(AVCodecContext *avctx){
|
||||
return 1;
|
||||
}
|
||||
|
||||
avcodec_get_frame_defaults(&f->current_picture);
|
||||
avcodec_get_frame_defaults(&f->last_picture);
|
||||
f->version= AV_RL32(avctx->extradata)>>16;
|
||||
common_init(avctx);
|
||||
init_vlcs(f);
|
||||
|
@ -157,6 +157,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
|
||||
c->avctx = avctx;
|
||||
|
||||
avcodec_get_frame_defaults(&c->pic);
|
||||
c->pic.data[0] = NULL;
|
||||
|
||||
switch (avctx->bits_per_coded_sample) {
|
||||
|
@ -1,5 +1,4 @@
|
||||
/*
|
||||
* 8SVX audio decoder
|
||||
* Copyright (C) 2008 Jaikrishnan Menon
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
@ -22,9 +21,17 @@
|
||||
/**
|
||||
* @file
|
||||
* 8svx audio decoder
|
||||
* @author Jaikrishnan Menon
|
||||
* supports: fibonacci delta encoding
|
||||
* : exponential encoding
|
||||
*
|
||||
* For more information about the 8SVX format:
|
||||
* http://netghost.narod.ru/gff/vendspec/iff/iff.txt
|
||||
* http://sox.sourceforge.net/AudioFormats-11.html
|
||||
* http://aminet.net/package/mus/misc/wavepak
|
||||
* http://amigan.1emu.net/reg/8SVX.txt
|
||||
*
|
||||
* Samples can be found here:
|
||||
* http://aminet.net/mods/smpl/
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
@ -40,7 +47,6 @@ static const int16_t fibonacci[16] = { -34<<8, -21<<8, -13<<8, -8<<8, -5<<8,
|
||||
static const int16_t exponential[16] = { -128<<8, -64<<8, -32<<8, -16<<8, -8<<8, -4<<8, -2<<8, -1<<8,
|
||||
0, 1<<8, 2<<8, 4<<8, 8<<8, 16<<8, 32<<8, 64<<8 };
|
||||
|
||||
/** decode a frame */
|
||||
static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||
AVPacket *avpkt)
|
||||
{
|
||||
@ -73,7 +79,6 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, int *data_si
|
||||
return consumed;
|
||||
}
|
||||
|
||||
/** initialize 8svx decoder */
|
||||
static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
EightSvxContext *esc = avctx->priv_data;
|
||||
|
@ -143,7 +143,7 @@ OBJS-$(CONFIG_FFV1_ENCODER) += ffv1.o rangecoder.o
|
||||
OBJS-$(CONFIG_FFVHUFF_DECODER) += huffyuv.o
|
||||
OBJS-$(CONFIG_FFVHUFF_ENCODER) += huffyuv.o
|
||||
OBJS-$(CONFIG_FLAC_DECODER) += flacdec.o flacdata.o flac.o vorbis_data.o
|
||||
OBJS-$(CONFIG_FLAC_ENCODER) += flacenc.o flacdata.o flac.o
|
||||
OBJS-$(CONFIG_FLAC_ENCODER) += flacenc.o flacdata.o flac.o vorbis_data.o
|
||||
OBJS-$(CONFIG_FLASHSV_DECODER) += flashsv.o
|
||||
OBJS-$(CONFIG_FLASHSV_ENCODER) += flashsvenc.o
|
||||
OBJS-$(CONFIG_FLASHSV2_ENCODER) += flashsv2enc.o
|
||||
@ -276,8 +276,9 @@ OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4.o msmpeg4data.o h263dec.o \
|
||||
h263.o ituh263dec.o mpeg4videodec.o
|
||||
OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o
|
||||
OBJS-$(CONFIG_MSVIDEO1_DECODER) += msvideo1.o
|
||||
OBJS-$(CONFIG_MSVIDEO1_ENCODER) += msvideo1enc.o elbg.o
|
||||
OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o
|
||||
OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o
|
||||
OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o mjpegdec.o mjpeg.o
|
||||
OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o
|
||||
OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o
|
||||
OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o
|
||||
@ -329,6 +330,7 @@ OBJS-$(CONFIG_RV30_DECODER) += rv30.o rv34.o rv30dsp.o \
|
||||
mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_RV40_DECODER) += rv40.o rv34.o rv40dsp.o \
|
||||
mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_S302M_DECODER) += s302m.o
|
||||
OBJS-$(CONFIG_SGI_DECODER) += sgidec.o
|
||||
OBJS-$(CONFIG_SGI_ENCODER) += sgienc.o rle.o
|
||||
OBJS-$(CONFIG_SHORTEN_DECODER) += shorten.o
|
||||
@ -531,30 +533,32 @@ OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_DV_DEMUXER) += dvdata.o
|
||||
OBJS-$(CONFIG_DV_MUXER) += dvdata.o
|
||||
OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o flacdata.o flac.o
|
||||
OBJS-$(CONFIG_FLAC_MUXER) += flacdec.o flacdata.o flac.o
|
||||
OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o flacdata.o flac.o vorbis_data.o
|
||||
OBJS-$(CONFIG_FLAC_MUXER) += flacdec.o flacdata.o flac.o vorbis_data.o
|
||||
OBJS-$(CONFIG_FLV_DEMUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_GXF_DEMUXER) += mpeg12data.o
|
||||
OBJS-$(CONFIG_IFF_DEMUXER) += iff.o
|
||||
OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += xiph.o mpeg4audio.o \
|
||||
OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += xiph.o mpeg4audio.o vorbis_data.o \
|
||||
flacdec.o flacdata.o flac.o
|
||||
OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o mpeg4audio.o \
|
||||
flacdec.o flacdata.o flac.o \
|
||||
mpegaudiodata.o
|
||||
mpegaudiodata.o vorbis_data.o
|
||||
OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MOV_MUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MPEGTS_MUXER) += mpegvideo.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_MPEGTS_DEMUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o
|
||||
OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \
|
||||
dirac.o mpeg12data.o
|
||||
OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o
|
||||
dirac.o mpeg12data.o vorbis_data.o
|
||||
OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o \
|
||||
vorbis_data.o
|
||||
OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o xiph.o
|
||||
OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \
|
||||
flacdec.o flacdata.o flac.o \
|
||||
mpegaudiodata.o
|
||||
mpegaudiodata.o vorbis_data.o
|
||||
OBJS-$(CONFIG_WTV_DEMUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
|
||||
# external codec libraries
|
||||
OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o
|
||||
@ -598,7 +602,8 @@ OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o
|
||||
OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o
|
||||
OBJS-$(CONFIG_DVBSUB_PARSER) += dvbsub_parser.o
|
||||
OBJS-$(CONFIG_DVDSUB_PARSER) += dvdsub_parser.o
|
||||
OBJS-$(CONFIG_FLAC_PARSER) += flac_parser.o flacdata.o flac.o
|
||||
OBJS-$(CONFIG_FLAC_PARSER) += flac_parser.o flacdata.o flac.o \
|
||||
vorbis_data.o
|
||||
OBJS-$(CONFIG_H261_PARSER) += h261_parser.o
|
||||
OBJS-$(CONFIG_H263_PARSER) += h263_parser.o
|
||||
OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264.o h264_hl_motion.o \
|
||||
@ -691,14 +696,6 @@ $(SUBDIR)cos_fixed_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
|
||||
$(SUBDIR)sin_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
|
||||
$(M)./$< sin > $@
|
||||
|
||||
ifdef CONFIG_MPEGAUDIO_HP
|
||||
$(SUBDIR)mpegaudio_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DFRAC_BITS=23
|
||||
$(SUBDIR)mpegaudio_tablegen.ho: CPPFLAGS += -DFRAC_BITS=23
|
||||
else
|
||||
$(SUBDIR)mpegaudio_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DFRAC_BITS=15
|
||||
$(SUBDIR)mpegaudio_tablegen.ho: CPPFLAGS += -DFRAC_BITS=15
|
||||
endif
|
||||
|
||||
ifdef CONFIG_SMALL
|
||||
$(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=1
|
||||
else
|
||||
|
@ -216,7 +216,7 @@ static av_cold int a64multi_init_encoder(AVCodecContext *avctx)
|
||||
|
||||
avcodec_get_frame_defaults(&c->picture);
|
||||
avctx->coded_frame = &c->picture;
|
||||
avctx->coded_frame->pict_type = FF_I_TYPE;
|
||||
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
avctx->coded_frame->key_frame = 1;
|
||||
if (!avctx->codec_tag)
|
||||
avctx->codec_tag = AV_RL32("a64m");
|
||||
@ -290,7 +290,7 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
|
||||
/* fill up mc_meta_charset with data until lifetime exceeds */
|
||||
if (c->mc_frame_counter < c->mc_lifetime) {
|
||||
*p = *pict;
|
||||
p->pict_type = FF_I_TYPE;
|
||||
p->pict_type = AV_PICTURE_TYPE_I;
|
||||
p->key_frame = 1;
|
||||
to_meta_with_crop(avctx, p, meta + 32000 * c->mc_frame_counter);
|
||||
c->mc_frame_counter++;
|
||||
|
@ -30,6 +30,8 @@
|
||||
* add sane pulse detection
|
||||
***********************************/
|
||||
|
||||
#include "libavutil/libm.h" // brought forward to work around cygwin header breakage
|
||||
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include "avcodec.h"
|
||||
@ -37,7 +39,6 @@
|
||||
#include "aac.h"
|
||||
#include "aacenc.h"
|
||||
#include "aactab.h"
|
||||
#include "libavutil/libm.h"
|
||||
|
||||
/** bits needed to code codebook run value for long windows */
|
||||
static const uint8_t run_value_bits_long[64] = {
|
||||
|
@ -315,6 +315,10 @@ static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
|
||||
if (get_bits1(gb))
|
||||
skip_bits(gb, 3); // mixdown_coeff_index and pseudo_surround
|
||||
|
||||
if (get_bits_left(gb) < 4 * (num_front + num_side + num_back + num_lfe + num_assoc_data + num_cc)) {
|
||||
av_log(avctx, AV_LOG_ERROR, overread_err);
|
||||
return -1;
|
||||
}
|
||||
decode_channel_map(new_che_pos[TYPE_CPE], new_che_pos[TYPE_SCE], AAC_CHANNEL_FRONT, gb, num_front);
|
||||
decode_channel_map(new_che_pos[TYPE_CPE], new_che_pos[TYPE_SCE], AAC_CHANNEL_SIDE, gb, num_side );
|
||||
decode_channel_map(new_che_pos[TYPE_CPE], new_che_pos[TYPE_SCE], AAC_CHANNEL_BACK, gb, num_back );
|
||||
|
@ -489,7 +489,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
|
||||
AACEncContext *s = avctx->priv_data;
|
||||
int16_t *samples = s->samples, *samples2, *la;
|
||||
ChannelElement *cpe;
|
||||
int i, j, chans, tag, start_ch;
|
||||
int i, ch, w, chans, tag, start_ch;
|
||||
const uint8_t *chan_map = aac_chan_configs[avctx->channels-1];
|
||||
int chan_el_counter[4];
|
||||
FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
|
||||
@ -524,34 +524,33 @@ static int aac_encode_frame(AVCodecContext *avctx,
|
||||
tag = chan_map[i+1];
|
||||
chans = tag == TYPE_CPE ? 2 : 1;
|
||||
cpe = &s->cpe[i];
|
||||
for (j = 0; j < chans; j++) {
|
||||
IndividualChannelStream *ics = &cpe->ch[j].ics;
|
||||
int k;
|
||||
int cur_channel = start_ch + j;
|
||||
for (ch = 0; ch < chans; ch++) {
|
||||
IndividualChannelStream *ics = &cpe->ch[ch].ics;
|
||||
int cur_channel = start_ch + ch;
|
||||
samples2 = samples + cur_channel;
|
||||
la = samples2 + (448+64) * avctx->channels;
|
||||
if (!data)
|
||||
la = NULL;
|
||||
if (tag == TYPE_LFE) {
|
||||
wi[j].window_type[0] = ONLY_LONG_SEQUENCE;
|
||||
wi[j].window_shape = 0;
|
||||
wi[j].num_windows = 1;
|
||||
wi[j].grouping[0] = 1;
|
||||
wi[ch].window_type[0] = ONLY_LONG_SEQUENCE;
|
||||
wi[ch].window_shape = 0;
|
||||
wi[ch].num_windows = 1;
|
||||
wi[ch].grouping[0] = 1;
|
||||
} else {
|
||||
wi[j] = ff_psy_suggest_window(&s->psy, samples2, la, cur_channel,
|
||||
wi[ch] = s->psy.model->window(&s->psy, samples2, la, cur_channel,
|
||||
ics->window_sequence[0]);
|
||||
}
|
||||
ics->window_sequence[1] = ics->window_sequence[0];
|
||||
ics->window_sequence[0] = wi[j].window_type[0];
|
||||
ics->window_sequence[0] = wi[ch].window_type[0];
|
||||
ics->use_kb_window[1] = ics->use_kb_window[0];
|
||||
ics->use_kb_window[0] = wi[j].window_shape;
|
||||
ics->num_windows = wi[j].num_windows;
|
||||
ics->use_kb_window[0] = wi[ch].window_shape;
|
||||
ics->num_windows = wi[ch].num_windows;
|
||||
ics->swb_sizes = s->psy.bands [ics->num_windows == 8];
|
||||
ics->num_swb = tag == TYPE_LFE ? 12 : s->psy.num_bands[ics->num_windows == 8];
|
||||
for (k = 0; k < ics->num_windows; k++)
|
||||
ics->group_len[k] = wi[j].grouping[k];
|
||||
for (w = 0; w < ics->num_windows; w++)
|
||||
ics->group_len[w] = wi[ch].grouping[w];
|
||||
|
||||
apply_window_and_mdct(avctx, s, &cpe->ch[j], samples2);
|
||||
apply_window_and_mdct(avctx, s, &cpe->ch[ch], samples2);
|
||||
}
|
||||
start_ch += chans;
|
||||
}
|
||||
@ -569,10 +568,10 @@ static int aac_encode_frame(AVCodecContext *avctx,
|
||||
cpe = &s->cpe[i];
|
||||
put_bits(&s->pb, 3, tag);
|
||||
put_bits(&s->pb, 4, chan_el_counter[tag]++);
|
||||
for (j = 0; j < chans; j++) {
|
||||
s->cur_channel = start_ch + j;
|
||||
ff_psy_set_band_info(&s->psy, s->cur_channel, cpe->ch[j].coeffs, &wi[j]);
|
||||
s->coder->search_for_quantizers(avctx, s, &cpe->ch[j], s->lambda);
|
||||
for (ch = 0; ch < chans; ch++) {
|
||||
s->cur_channel = start_ch + ch;
|
||||
s->psy.model->analyze(&s->psy, s->cur_channel, cpe->ch[ch].coeffs, &wi[ch]);
|
||||
s->coder->search_for_quantizers(avctx, s, &cpe->ch[ch], s->lambda);
|
||||
}
|
||||
cpe->common_window = 0;
|
||||
if (chans > 1
|
||||
@ -580,8 +579,8 @@ static int aac_encode_frame(AVCodecContext *avctx,
|
||||
&& wi[0].window_shape == wi[1].window_shape) {
|
||||
|
||||
cpe->common_window = 1;
|
||||
for (j = 0; j < wi[0].num_windows; j++) {
|
||||
if (wi[0].grouping[j] != wi[1].grouping[j]) {
|
||||
for (w = 0; w < wi[0].num_windows; w++) {
|
||||
if (wi[0].grouping[w] != wi[1].grouping[w]) {
|
||||
cpe->common_window = 0;
|
||||
break;
|
||||
}
|
||||
@ -598,9 +597,9 @@ static int aac_encode_frame(AVCodecContext *avctx,
|
||||
encode_ms_info(&s->pb, cpe);
|
||||
}
|
||||
}
|
||||
for (j = 0; j < chans; j++) {
|
||||
s->cur_channel = start_ch + j;
|
||||
encode_individual_channel(avctx, s, &cpe->ch[j], cpe->common_window);
|
||||
for (ch = 0; ch < chans; ch++) {
|
||||
s->cur_channel = start_ch + ch;
|
||||
encode_individual_channel(avctx, s, &cpe->ch[ch], cpe->common_window);
|
||||
}
|
||||
start_ch += chans;
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ static av_cold int aasc_decode_init(AVCodecContext *avctx)
|
||||
AascContext *s = avctx->priv_data;
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
avctx->pix_fmt = PIX_FMT_BGR24;
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -158,6 +158,7 @@ typedef struct AC3EncOptions {
|
||||
|
||||
/* other encoding options */
|
||||
int allow_per_frame_metadata;
|
||||
int stereo_rematrixing;
|
||||
} AC3EncOptions;
|
||||
|
||||
|
||||
|
@ -1298,6 +1298,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
|
||||
float *out_samples_flt = (float *)data;
|
||||
int16_t *out_samples = (int16_t *)data;
|
||||
int blk, ch, err;
|
||||
int data_size_orig, data_size_tmp;
|
||||
const uint8_t *channel_map;
|
||||
const float *output[AC3_MAX_CHANNELS];
|
||||
|
||||
@ -1314,6 +1315,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
|
||||
init_get_bits(&s->gbc, buf, buf_size * 8);
|
||||
|
||||
/* parse the syncinfo */
|
||||
data_size_orig = *data_size;
|
||||
*data_size = 0;
|
||||
err = parse_frame_header(s);
|
||||
|
||||
@ -1397,6 +1399,11 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
|
||||
channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on];
|
||||
for (ch = 0; ch < s->out_channels; ch++)
|
||||
output[ch] = s->output[channel_map[ch]];
|
||||
data_size_tmp = s->num_blocks * 256 * avctx->channels;
|
||||
data_size_tmp *= avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(*out_samples_flt) : sizeof(*out_samples);
|
||||
if (data_size_orig < data_size_tmp)
|
||||
return -1;
|
||||
*data_size = data_size_tmp;
|
||||
for (blk = 0; blk < s->num_blocks; blk++) {
|
||||
if (!err && decode_audio_block(s, blk)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n");
|
||||
@ -1410,8 +1417,6 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
|
||||
out_samples += 256 * s->out_channels;
|
||||
}
|
||||
}
|
||||
*data_size = s->num_blocks * 256 * avctx->channels;
|
||||
*data_size *= avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(*out_samples_flt) : sizeof(*out_samples);
|
||||
return FFMIN(buf_size, s->frame_size);
|
||||
}
|
||||
|
||||
|
@ -164,8 +164,10 @@ static void ac3_extract_exponents_c(uint8_t *exp, int32_t *coef, int nb_coefs)
|
||||
if (e >= 24) {
|
||||
e = 24;
|
||||
coef[i] = 0;
|
||||
} else if (e < 0) {
|
||||
e = 0;
|
||||
coef[i] = av_clip(coef[i], -16777215, 16777215);
|
||||
}
|
||||
av_assert2(e >= 0);
|
||||
}
|
||||
exp[i] = e;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "libavutil/audioconvert.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/crc.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "avcodec.h"
|
||||
@ -52,12 +53,6 @@
|
||||
/** Maximum number of exponent groups. +1 for separate DC exponent. */
|
||||
#define AC3_MAX_EXP_GROUPS 85
|
||||
|
||||
/* stereo rematrixing algorithms */
|
||||
#define AC3_REMATRIXING_IS_STATIC 0x1
|
||||
#define AC3_REMATRIXING_SUMS 0
|
||||
#define AC3_REMATRIXING_NONE 1
|
||||
#define AC3_REMATRIXING_ALWAYS 3
|
||||
|
||||
#if CONFIG_AC3ENC_FLOAT
|
||||
#define MAC_COEF(d,a,b) ((d)+=(a)*(b))
|
||||
typedef float SampleType;
|
||||
@ -137,10 +132,10 @@ typedef struct AC3EncodeContext {
|
||||
int loro_surround_mix_level; ///< Lo/Ro surround mix level code
|
||||
|
||||
int cutoff; ///< user-specified cutoff frequency, in Hz
|
||||
int bandwidth_code[AC3_MAX_CHANNELS]; ///< bandwidth code (0 to 60) (chbwcod)
|
||||
int bandwidth_code; ///< bandwidth code (0 to 60) (chbwcod)
|
||||
int nb_coefs[AC3_MAX_CHANNELS];
|
||||
|
||||
int rematrixing; ///< determines how rematrixing strategy is calculated
|
||||
int rematrixing_enabled; ///< stereo rematrixing enabled
|
||||
int num_rematrixing_bands; ///< number of rematrixing bands
|
||||
|
||||
/* bitrate allocation control */
|
||||
@ -202,44 +197,46 @@ static const float extmixlev_options[EXTMIXLEV_NUM_OPTIONS] = {
|
||||
#if CONFIG_AC3ENC_FLOAT || !CONFIG_AC3_FLOAT_ENCODER //we need this exactly once compiled in
|
||||
const AVOption ff_ac3_options[] = {
|
||||
/* Metadata Options */
|
||||
{"per_frame_metadata", "Allow Changing Metadata Per-Frame", OFFSET(allow_per_frame_metadata), FF_OPT_TYPE_INT, 0, 0, 1, AC3ENC_PARAM},
|
||||
{"per_frame_metadata", "Allow Changing Metadata Per-Frame", OFFSET(allow_per_frame_metadata), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, 1, AC3ENC_PARAM},
|
||||
/* downmix levels */
|
||||
{"center_mixlev", "Center Mix Level", OFFSET(center_mix_level), FF_OPT_TYPE_FLOAT, LEVEL_MINUS_4POINT5DB, 0.0, 1.0, AC3ENC_PARAM},
|
||||
{"surround_mixlev", "Surround Mix Level", OFFSET(surround_mix_level), FF_OPT_TYPE_FLOAT, LEVEL_MINUS_6DB, 0.0, 1.0, AC3ENC_PARAM},
|
||||
{"center_mixlev", "Center Mix Level", OFFSET(center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = LEVEL_MINUS_4POINT5DB }, 0.0, 1.0, AC3ENC_PARAM},
|
||||
{"surround_mixlev", "Surround Mix Level", OFFSET(surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = LEVEL_MINUS_6DB }, 0.0, 1.0, AC3ENC_PARAM},
|
||||
/* audio production information */
|
||||
{"mixing_level", "Mixing Level", OFFSET(mixing_level), FF_OPT_TYPE_INT, -1, -1, 111, AC3ENC_PARAM},
|
||||
{"room_type", "Room Type", OFFSET(room_type), FF_OPT_TYPE_INT, -1, -1, 2, AC3ENC_PARAM, "room_type"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
|
||||
{"large", "Large Room", 0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
|
||||
{"small", "Small Room", 0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
|
||||
{"mixing_level", "Mixing Level", OFFSET(mixing_level), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 111, AC3ENC_PARAM},
|
||||
{"room_type", "Room Type", OFFSET(room_type), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "room_type"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
|
||||
{"large", "Large Room", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
|
||||
{"small", "Small Room", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
|
||||
/* other metadata options */
|
||||
{"copyright", "Copyright Bit", OFFSET(copyright), FF_OPT_TYPE_INT, 0, 0, 1, AC3ENC_PARAM},
|
||||
{"dialnorm", "Dialogue Level (dB)", OFFSET(dialogue_level), FF_OPT_TYPE_INT, -31, -31, -1, AC3ENC_PARAM},
|
||||
{"dsur_mode", "Dolby Surround Mode", OFFSET(dolby_surround_mode), FF_OPT_TYPE_INT, 0, 0, 2, AC3ENC_PARAM, "dsur_mode"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
|
||||
{"on", "Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
|
||||
{"off", "Not Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
|
||||
{"original", "Original Bit Stream", OFFSET(original), FF_OPT_TYPE_INT, 1, 0, 1, AC3ENC_PARAM},
|
||||
{"copyright", "Copyright Bit", OFFSET(copyright), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, 1, AC3ENC_PARAM},
|
||||
{"dialnorm", "Dialogue Level (dB)", OFFSET(dialogue_level), FF_OPT_TYPE_INT, {.dbl = -31 }, -31, -1, AC3ENC_PARAM},
|
||||
{"dsur_mode", "Dolby Surround Mode", OFFSET(dolby_surround_mode), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, 2, AC3ENC_PARAM, "dsur_mode"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
|
||||
{"on", "Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
|
||||
{"off", "Not Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
|
||||
{"original", "Original Bit Stream", OFFSET(original), FF_OPT_TYPE_INT, {.dbl = 1 }, 0, 1, AC3ENC_PARAM},
|
||||
/* extended bitstream information */
|
||||
{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), FF_OPT_TYPE_INT, -1, -1, 2, AC3ENC_PARAM, "dmix_mode"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
|
||||
{"ltrt", "Lt/Rt Downmix Preferred", 0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
|
||||
{"loro", "Lo/Ro Downmix Preferred", 0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
|
||||
{"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), FF_OPT_TYPE_FLOAT, -1.0, -1.0, 2.0, AC3ENC_PARAM},
|
||||
{"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), FF_OPT_TYPE_FLOAT, -1.0, -1.0, 2.0, AC3ENC_PARAM},
|
||||
{"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), FF_OPT_TYPE_FLOAT, -1.0, -1.0, 2.0, AC3ENC_PARAM},
|
||||
{"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), FF_OPT_TYPE_FLOAT, -1.0, -1.0, 2.0, AC3ENC_PARAM},
|
||||
{"dsurex_mode", "Dolby Surround EX Mode", OFFSET(dolby_surround_ex_mode), FF_OPT_TYPE_INT, -1, -1, 2, AC3ENC_PARAM, "dsurex_mode"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
|
||||
{"on", "Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
|
||||
{"off", "Not Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
|
||||
{"dheadphone_mode", "Dolby Headphone Mode", OFFSET(dolby_headphone_mode), FF_OPT_TYPE_INT, -1, -1, 2, AC3ENC_PARAM, "dheadphone_mode"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
|
||||
{"on", "Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
|
||||
{"off", "Not Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
|
||||
{"ad_conv_type", "A/D Converter Type", OFFSET(ad_converter_type), FF_OPT_TYPE_INT, -1, -1, 1, AC3ENC_PARAM, "ad_conv_type"},
|
||||
{"standard", "Standard (default)", 0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"},
|
||||
{"hdcd", "HDCD", 0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"},
|
||||
{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "dmix_mode"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
|
||||
{"ltrt", "Lt/Rt Downmix Preferred", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
|
||||
{"loro", "Lo/Ro Downmix Preferred", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
|
||||
{"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM},
|
||||
{"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM},
|
||||
{"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM},
|
||||
{"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM},
|
||||
{"dsurex_mode", "Dolby Surround EX Mode", OFFSET(dolby_surround_ex_mode), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "dsurex_mode"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
|
||||
{"on", "Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
|
||||
{"off", "Not Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
|
||||
{"dheadphone_mode", "Dolby Headphone Mode", OFFSET(dolby_headphone_mode), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "dheadphone_mode"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
|
||||
{"on", "Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
|
||||
{"off", "Not Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
|
||||
{"ad_conv_type", "A/D Converter Type", OFFSET(ad_converter_type), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 1, AC3ENC_PARAM, "ad_conv_type"},
|
||||
{"standard", "Standard (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"},
|
||||
{"hdcd", "HDCD", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"},
|
||||
/* Other Encoding Options */
|
||||
{"stereo_rematrixing", "Stereo Rematrixing", OFFSET(stereo_rematrixing), FF_OPT_TYPE_INT, {.dbl = 1 }, 0, 1, AC3ENC_PARAM},
|
||||
{NULL}
|
||||
};
|
||||
#endif
|
||||
@ -404,28 +401,6 @@ static void apply_mdct(AC3EncodeContext *s)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize stereo rematrixing.
|
||||
* If the strategy does not change for each frame, set the rematrixing flags.
|
||||
*/
|
||||
static void rematrixing_init(AC3EncodeContext *s)
|
||||
{
|
||||
if (s->channel_mode == AC3_CHMODE_STEREO)
|
||||
s->rematrixing = AC3_REMATRIXING_SUMS;
|
||||
else
|
||||
s->rematrixing = AC3_REMATRIXING_NONE;
|
||||
/* NOTE: AC3_REMATRIXING_ALWAYS might be used in
|
||||
the future in conjunction with channel coupling. */
|
||||
|
||||
if (s->rematrixing & AC3_REMATRIXING_IS_STATIC) {
|
||||
int flag = (s->rematrixing == AC3_REMATRIXING_ALWAYS);
|
||||
s->blocks[0].new_rematrixing_strategy = 1;
|
||||
memset(s->blocks[0].rematrixing_flags, flag,
|
||||
sizeof(s->blocks[0].rematrixing_flags));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine rematrixing flags for each block and band.
|
||||
*/
|
||||
@ -435,16 +410,18 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
|
||||
int blk, bnd, i;
|
||||
AC3Block *block, *block0;
|
||||
|
||||
s->num_rematrixing_bands = 4;
|
||||
|
||||
if (s->rematrixing & AC3_REMATRIXING_IS_STATIC)
|
||||
if (s->channel_mode != AC3_CHMODE_STEREO)
|
||||
return;
|
||||
|
||||
s->num_rematrixing_bands = 4;
|
||||
|
||||
nb_coefs = FFMIN(s->nb_coefs[0], s->nb_coefs[1]);
|
||||
|
||||
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
block = &s->blocks[blk];
|
||||
block->new_rematrixing_strategy = !blk;
|
||||
if (!s->rematrixing_enabled)
|
||||
continue;
|
||||
for (bnd = 0; bnd < s->num_rematrixing_bands; bnd++) {
|
||||
/* calculate calculate sum of squared coeffs for one band in one block */
|
||||
int start = ff_ac3_rematrix_band_tab[bnd];
|
||||
@ -488,7 +465,7 @@ static void apply_rematrixing(AC3EncodeContext *s)
|
||||
int start, end;
|
||||
uint8_t *flags;
|
||||
|
||||
if (s->rematrixing == AC3_REMATRIXING_NONE)
|
||||
if (!s->rematrixing_enabled)
|
||||
return;
|
||||
|
||||
nb_coefs = FFMIN(s->nb_coefs[0], s->nb_coefs[1]);
|
||||
@ -518,11 +495,13 @@ static void apply_rematrixing(AC3EncodeContext *s)
|
||||
*/
|
||||
static av_cold void exponent_init(AC3EncodeContext *s)
|
||||
{
|
||||
int i;
|
||||
for (i = 73; i < 256; i++) {
|
||||
exponent_group_tab[0][i] = (i - 1) / 3;
|
||||
exponent_group_tab[1][i] = (i + 2) / 6;
|
||||
exponent_group_tab[2][i] = (i + 8) / 12;
|
||||
int expstr, i, grpsize;
|
||||
|
||||
for (expstr = EXP_D15-1; expstr <= EXP_D45-1; expstr++) {
|
||||
grpsize = 3 << expstr;
|
||||
for (i = 73; i < 256; i++) {
|
||||
exponent_group_tab[expstr][i] = (i + grpsize - 4) / grpsize;
|
||||
}
|
||||
}
|
||||
/* LFE */
|
||||
exponent_group_tab[0][7] = 2;
|
||||
@ -555,56 +534,47 @@ static void extract_exponents(AC3EncodeContext *s)
|
||||
#define EXP_DIFF_THRESHOLD 500
|
||||
|
||||
|
||||
/**
|
||||
* Calculate exponent strategies for all blocks in a single channel.
|
||||
*/
|
||||
static void compute_exp_strategy_ch(AC3EncodeContext *s, uint8_t *exp_strategy,
|
||||
uint8_t *exp)
|
||||
{
|
||||
int blk, blk1;
|
||||
int exp_diff;
|
||||
|
||||
/* estimate if the exponent variation & decide if they should be
|
||||
reused in the next frame */
|
||||
exp_strategy[0] = EXP_NEW;
|
||||
exp += AC3_MAX_COEFS;
|
||||
for (blk = 1; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
exp_diff = s->dsp.sad[0](NULL, exp, exp - AC3_MAX_COEFS, 16, 16);
|
||||
if (exp_diff > EXP_DIFF_THRESHOLD)
|
||||
exp_strategy[blk] = EXP_NEW;
|
||||
else
|
||||
exp_strategy[blk] = EXP_REUSE;
|
||||
exp += AC3_MAX_COEFS;
|
||||
}
|
||||
|
||||
/* now select the encoding strategy type : if exponents are often
|
||||
recoded, we use a coarse encoding */
|
||||
blk = 0;
|
||||
while (blk < AC3_MAX_BLOCKS) {
|
||||
blk1 = blk + 1;
|
||||
while (blk1 < AC3_MAX_BLOCKS && exp_strategy[blk1] == EXP_REUSE)
|
||||
blk1++;
|
||||
switch (blk1 - blk) {
|
||||
case 1: exp_strategy[blk] = EXP_D45; break;
|
||||
case 2:
|
||||
case 3: exp_strategy[blk] = EXP_D25; break;
|
||||
default: exp_strategy[blk] = EXP_D15; break;
|
||||
}
|
||||
blk = blk1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate exponent strategies for all channels.
|
||||
* Array arrangement is reversed to simplify the per-channel calculation.
|
||||
*/
|
||||
static void compute_exp_strategy(AC3EncodeContext *s)
|
||||
{
|
||||
int ch, blk;
|
||||
int ch, blk, blk1;
|
||||
|
||||
for (ch = 0; ch < s->fbw_channels; ch++) {
|
||||
compute_exp_strategy_ch(s, s->exp_strategy[ch], s->blocks[0].exp[ch]);
|
||||
uint8_t *exp_strategy = s->exp_strategy[ch];
|
||||
uint8_t *exp = s->blocks[0].exp[ch];
|
||||
int exp_diff;
|
||||
|
||||
/* estimate if the exponent variation & decide if they should be
|
||||
reused in the next frame */
|
||||
exp_strategy[0] = EXP_NEW;
|
||||
exp += AC3_MAX_COEFS;
|
||||
for (blk = 1; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
exp_diff = s->dsp.sad[0](NULL, exp, exp - AC3_MAX_COEFS, 16, 16);
|
||||
if (exp_diff > EXP_DIFF_THRESHOLD)
|
||||
exp_strategy[blk] = EXP_NEW;
|
||||
else
|
||||
exp_strategy[blk] = EXP_REUSE;
|
||||
exp += AC3_MAX_COEFS;
|
||||
}
|
||||
|
||||
/* now select the encoding strategy type : if exponents are often
|
||||
recoded, we use a coarse encoding */
|
||||
blk = 0;
|
||||
while (blk < AC3_MAX_BLOCKS) {
|
||||
blk1 = blk + 1;
|
||||
while (blk1 < AC3_MAX_BLOCKS && exp_strategy[blk1] == EXP_REUSE)
|
||||
blk1++;
|
||||
switch (blk1 - blk) {
|
||||
case 1: exp_strategy[blk] = EXP_D45; break;
|
||||
case 2:
|
||||
case 3: exp_strategy[blk] = EXP_D25; break;
|
||||
default: exp_strategy[blk] = EXP_D15; break;
|
||||
}
|
||||
blk = blk1;
|
||||
}
|
||||
}
|
||||
if (s->lfe_on) {
|
||||
ch = s->lfe_channel;
|
||||
@ -821,35 +791,53 @@ static void count_frame_bits_fixed(AC3EncodeContext *s)
|
||||
* no auxilliary data
|
||||
*/
|
||||
|
||||
/* header size */
|
||||
/* header */
|
||||
frame_bits = 65;
|
||||
frame_bits += frame_bits_inc[s->channel_mode];
|
||||
|
||||
/* audio blocks */
|
||||
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
frame_bits += s->fbw_channels * 2 + 2; /* blksw * c, dithflag * c, dynrnge, cplstre */
|
||||
if (s->channel_mode == AC3_CHMODE_STEREO) {
|
||||
frame_bits++; /* rematstr */
|
||||
}
|
||||
frame_bits += 2 * s->fbw_channels; /* chexpstr[2] * c */
|
||||
if (s->lfe_on)
|
||||
frame_bits++; /* lfeexpstr */
|
||||
frame_bits++; /* baie */
|
||||
frame_bits++; /* snr */
|
||||
frame_bits += 2; /* delta / skip */
|
||||
}
|
||||
frame_bits++; /* cplinu for block 0 */
|
||||
/* bit alloc info */
|
||||
/* sdcycod[2], fdcycod[2], sgaincod[2], dbpbcod[2], floorcod[3] */
|
||||
/* csnroffset[6] */
|
||||
/* (fsnoffset[4] + fgaincod[4]) * c */
|
||||
frame_bits += 2*4 + 3 + 6 + s->channels * (4 + 3);
|
||||
/* block switch flags */
|
||||
frame_bits += s->fbw_channels;
|
||||
|
||||
/* auxdatae, crcrsv */
|
||||
frame_bits += 2;
|
||||
/* dither flags */
|
||||
frame_bits += s->fbw_channels;
|
||||
|
||||
/* dynamic range */
|
||||
frame_bits++;
|
||||
|
||||
/* coupling strategy */
|
||||
frame_bits++;
|
||||
if (!blk)
|
||||
frame_bits++;
|
||||
|
||||
/* exponent strategy */
|
||||
frame_bits += 2 * s->fbw_channels;
|
||||
if (s->lfe_on)
|
||||
frame_bits++;
|
||||
|
||||
/* bit allocation params */
|
||||
frame_bits++;
|
||||
if (!blk)
|
||||
frame_bits += 2 + 2 + 2 + 2 + 3;
|
||||
|
||||
/* snr offsets and fast gain codes */
|
||||
frame_bits++;
|
||||
if (!blk)
|
||||
frame_bits += 6 + s->channels * (4 + 3);
|
||||
|
||||
/* delta bit allocation */
|
||||
frame_bits++;
|
||||
|
||||
/* skipped data */
|
||||
frame_bits++;
|
||||
}
|
||||
|
||||
/* auxiliary data */
|
||||
frame_bits++;
|
||||
|
||||
/* CRC */
|
||||
frame_bits += 16;
|
||||
frame_bits += 1 + 16;
|
||||
|
||||
s->frame_bits_fixed = frame_bits;
|
||||
}
|
||||
@ -899,6 +887,7 @@ static void count_frame_bits(AC3EncodeContext *s)
|
||||
int blk, ch;
|
||||
int frame_bits = 0;
|
||||
|
||||
/* header */
|
||||
if (opt->audio_production_info)
|
||||
frame_bits += 7;
|
||||
if (s->bitstream_id == 6) {
|
||||
@ -908,18 +897,22 @@ static void count_frame_bits(AC3EncodeContext *s)
|
||||
frame_bits += 14;
|
||||
}
|
||||
|
||||
/* audio blocks */
|
||||
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
/* stereo rematrixing */
|
||||
if (s->channel_mode == AC3_CHMODE_STEREO &&
|
||||
s->blocks[blk].new_rematrixing_strategy) {
|
||||
frame_bits += s->num_rematrixing_bands;
|
||||
if (s->channel_mode == AC3_CHMODE_STEREO) {
|
||||
frame_bits++;
|
||||
if (s->blocks[blk].new_rematrixing_strategy)
|
||||
frame_bits += s->num_rematrixing_bands;
|
||||
}
|
||||
|
||||
/* bandwidth codes & gain range */
|
||||
for (ch = 0; ch < s->fbw_channels; ch++) {
|
||||
if (s->exp_strategy[ch][blk] != EXP_REUSE)
|
||||
frame_bits += 6 + 2; /* chbwcod[6], gainrng[2] */
|
||||
frame_bits += 6 + 2;
|
||||
}
|
||||
}
|
||||
|
||||
s->frame_bits = s->frame_bits_fixed + frame_bits;
|
||||
}
|
||||
|
||||
@ -1005,7 +998,8 @@ static int bit_alloc(AC3EncodeContext *s, int snr_offset)
|
||||
reset_block_bap(s);
|
||||
mantissa_bits = 0;
|
||||
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
AC3Block *block;
|
||||
AC3Block *block = &s->blocks[blk];
|
||||
AC3Block *ref_block;
|
||||
// initialize grouped mantissa counts. these are set so that they are
|
||||
// padded to the next whole group size when bits are counted in
|
||||
// compute_mantissa_size_final
|
||||
@ -1017,14 +1011,17 @@ static int bit_alloc(AC3EncodeContext *s, int snr_offset)
|
||||
blocks within a frame are the exponent values. We can take
|
||||
advantage of that by reusing the bit allocation pointers
|
||||
whenever we reuse exponents. */
|
||||
block = s->blocks[blk].exp_ref_block[ch];
|
||||
ref_block = block->exp_ref_block[ch];
|
||||
if (s->exp_strategy[ch][blk] != EXP_REUSE) {
|
||||
s->ac3dsp.bit_alloc_calc_bap(block->mask[ch], block->psd[ch], 0,
|
||||
s->nb_coefs[ch], snr_offset,
|
||||
s->bit_alloc.floor, ff_ac3_bap_tab,
|
||||
block->bap[ch]);
|
||||
s->ac3dsp.bit_alloc_calc_bap(ref_block->mask[ch],
|
||||
ref_block->psd[ch], 0,
|
||||
s->nb_coefs[ch], snr_offset,
|
||||
s->bit_alloc.floor, ff_ac3_bap_tab,
|
||||
ref_block->bap[ch]);
|
||||
}
|
||||
mantissa_bits += s->ac3dsp.compute_mantissa_size(mant_cnt, block->bap[ch], s->nb_coefs[ch]);
|
||||
mantissa_bits += s->ac3dsp.compute_mantissa_size(mant_cnt,
|
||||
ref_block->bap[ch],
|
||||
s->nb_coefs[ch]);
|
||||
}
|
||||
mantissa_bits += compute_mantissa_size_final(mant_cnt);
|
||||
}
|
||||
@ -1043,7 +1040,8 @@ static int cbr_bit_allocation(AC3EncodeContext *s)
|
||||
int snr_offset, snr_incr;
|
||||
|
||||
bits_left = 8 * s->frame_size - (s->frame_bits + s->exponent_bits);
|
||||
av_assert2(bits_left >= 0);
|
||||
if (bits_left < 0)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
snr_offset = s->coarse_snr_offset << 4;
|
||||
|
||||
@ -1121,27 +1119,6 @@ static int downgrade_exponents(AC3EncodeContext *s)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reduce the bandwidth to reduce the number of bits used for a given SNR offset.
|
||||
* This is a second fallback for when bit allocation still fails after exponents
|
||||
* have been downgraded.
|
||||
* @return non-zero if bandwidth reduction was unsuccessful
|
||||
*/
|
||||
static int reduce_bandwidth(AC3EncodeContext *s, int min_bw_code)
|
||||
{
|
||||
int ch;
|
||||
|
||||
if (s->bandwidth_code[0] > min_bw_code) {
|
||||
for (ch = 0; ch < s->fbw_channels; ch++) {
|
||||
s->bandwidth_code[ch]--;
|
||||
s->nb_coefs[ch] = s->bandwidth_code[ch] * 3 + 73;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform bit allocation search.
|
||||
* Finds the SNR offset value that maximizes quality and fits in the specified
|
||||
@ -1167,15 +1144,6 @@ static int compute_bit_allocation(AC3EncodeContext *s)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* fallback 2: reduce bandwidth */
|
||||
/* only do this if the user has not specified a specific cutoff
|
||||
frequency */
|
||||
if (!s->cutoff && !reduce_bandwidth(s, 0)) {
|
||||
process_exponents(s);
|
||||
ret = compute_bit_allocation(s);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* fallbacks were not enough... */
|
||||
break;
|
||||
}
|
||||
@ -1436,7 +1404,7 @@ static void output_audio_block(AC3EncodeContext *s, int blk)
|
||||
/* bandwidth */
|
||||
for (ch = 0; ch < s->fbw_channels; ch++) {
|
||||
if (s->exp_strategy[ch][blk] != EXP_REUSE)
|
||||
put_bits(&s->pb, 6, s->bandwidth_code[ch]);
|
||||
put_bits(&s->pb, 6, s->bandwidth_code);
|
||||
}
|
||||
|
||||
/* exponents */
|
||||
@ -1607,10 +1575,10 @@ static void dprint_options(AVCodecContext *avctx)
|
||||
char strbuf[32];
|
||||
|
||||
switch (s->bitstream_id) {
|
||||
case 6: strncpy(strbuf, "AC-3 (alt syntax)", 32); break;
|
||||
case 8: strncpy(strbuf, "AC-3 (standard)", 32); break;
|
||||
case 9: strncpy(strbuf, "AC-3 (dnet half-rate)", 32); break;
|
||||
case 10: strncpy(strbuf, "AC-3 (dnet quater-rate", 32); break;
|
||||
case 6: av_strlcpy(strbuf, "AC-3 (alt syntax)", 32); break;
|
||||
case 8: av_strlcpy(strbuf, "AC-3 (standard)", 32); break;
|
||||
case 9: av_strlcpy(strbuf, "AC-3 (dnet half-rate)", 32); break;
|
||||
case 10: av_strlcpy(strbuf, "AC-3 (dnet quater-rate", 32); break;
|
||||
default: snprintf(strbuf, 32, "ERROR");
|
||||
}
|
||||
av_dlog(avctx, "bitstream_id: %s (%d)\n", strbuf, s->bitstream_id);
|
||||
@ -1637,9 +1605,9 @@ static void dprint_options(AVCodecContext *avctx)
|
||||
if (opt->audio_production_info) {
|
||||
av_dlog(avctx, "mixing_level: %ddB\n", opt->mixing_level);
|
||||
switch (opt->room_type) {
|
||||
case 0: strncpy(strbuf, "notindicated", 32); break;
|
||||
case 1: strncpy(strbuf, "large", 32); break;
|
||||
case 2: strncpy(strbuf, "small", 32); break;
|
||||
case 0: av_strlcpy(strbuf, "notindicated", 32); break;
|
||||
case 1: av_strlcpy(strbuf, "large", 32); break;
|
||||
case 2: av_strlcpy(strbuf, "small", 32); break;
|
||||
default: snprintf(strbuf, 32, "ERROR (%d)", opt->room_type);
|
||||
}
|
||||
av_dlog(avctx, "room_type: %s\n", strbuf);
|
||||
@ -1651,9 +1619,9 @@ static void dprint_options(AVCodecContext *avctx)
|
||||
av_dlog(avctx, "dialnorm: %ddB\n", opt->dialogue_level);
|
||||
if (s->channel_mode == AC3_CHMODE_STEREO) {
|
||||
switch (opt->dolby_surround_mode) {
|
||||
case 0: strncpy(strbuf, "notindicated", 32); break;
|
||||
case 1: strncpy(strbuf, "on", 32); break;
|
||||
case 2: strncpy(strbuf, "off", 32); break;
|
||||
case 0: av_strlcpy(strbuf, "notindicated", 32); break;
|
||||
case 1: av_strlcpy(strbuf, "on", 32); break;
|
||||
case 2: av_strlcpy(strbuf, "off", 32); break;
|
||||
default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_mode);
|
||||
}
|
||||
av_dlog(avctx, "dsur_mode: %s\n", strbuf);
|
||||
@ -1665,9 +1633,9 @@ static void dprint_options(AVCodecContext *avctx)
|
||||
if (s->bitstream_id == 6) {
|
||||
if (opt->extended_bsi_1) {
|
||||
switch (opt->preferred_stereo_downmix) {
|
||||
case 0: strncpy(strbuf, "notindicated", 32); break;
|
||||
case 1: strncpy(strbuf, "ltrt", 32); break;
|
||||
case 2: strncpy(strbuf, "loro", 32); break;
|
||||
case 0: av_strlcpy(strbuf, "notindicated", 32); break;
|
||||
case 1: av_strlcpy(strbuf, "ltrt", 32); break;
|
||||
case 2: av_strlcpy(strbuf, "loro", 32); break;
|
||||
default: snprintf(strbuf, 32, "ERROR (%d)", opt->preferred_stereo_downmix);
|
||||
}
|
||||
av_dlog(avctx, "dmix_mode: %s\n", strbuf);
|
||||
@ -1684,23 +1652,23 @@ static void dprint_options(AVCodecContext *avctx)
|
||||
}
|
||||
if (opt->extended_bsi_2) {
|
||||
switch (opt->dolby_surround_ex_mode) {
|
||||
case 0: strncpy(strbuf, "notindicated", 32); break;
|
||||
case 1: strncpy(strbuf, "on", 32); break;
|
||||
case 2: strncpy(strbuf, "off", 32); break;
|
||||
case 0: av_strlcpy(strbuf, "notindicated", 32); break;
|
||||
case 1: av_strlcpy(strbuf, "on", 32); break;
|
||||
case 2: av_strlcpy(strbuf, "off", 32); break;
|
||||
default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_ex_mode);
|
||||
}
|
||||
av_dlog(avctx, "dsurex_mode: %s\n", strbuf);
|
||||
switch (opt->dolby_headphone_mode) {
|
||||
case 0: strncpy(strbuf, "notindicated", 32); break;
|
||||
case 1: strncpy(strbuf, "on", 32); break;
|
||||
case 2: strncpy(strbuf, "off", 32); break;
|
||||
case 0: av_strlcpy(strbuf, "notindicated", 32); break;
|
||||
case 1: av_strlcpy(strbuf, "on", 32); break;
|
||||
case 2: av_strlcpy(strbuf, "off", 32); break;
|
||||
default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_headphone_mode);
|
||||
}
|
||||
av_dlog(avctx, "dheadphone_mode: %s\n", strbuf);
|
||||
|
||||
switch (opt->ad_converter_type) {
|
||||
case 0: strncpy(strbuf, "standard", 32); break;
|
||||
case 1: strncpy(strbuf, "hdcd", 32); break;
|
||||
case 0: av_strlcpy(strbuf, "standard", 32); break;
|
||||
case 1: av_strlcpy(strbuf, "hdcd", 32); break;
|
||||
default: snprintf(strbuf, 32, "ERROR (%d)", opt->ad_converter_type);
|
||||
}
|
||||
av_dlog(avctx, "ad_conv_type: %s\n", strbuf);
|
||||
@ -2062,6 +2030,9 @@ static av_cold int validate_options(AVCodecContext *avctx, AC3EncodeContext *s)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
s->rematrixing_enabled = s->options.stereo_rematrixing &&
|
||||
(s->channel_mode == AC3_CHMODE_STEREO);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2073,22 +2044,21 @@ static av_cold int validate_options(AVCodecContext *avctx, AC3EncodeContext *s)
|
||||
*/
|
||||
static av_cold void set_bandwidth(AC3EncodeContext *s)
|
||||
{
|
||||
int ch, bw_code;
|
||||
int ch;
|
||||
|
||||
if (s->cutoff) {
|
||||
/* calculate bandwidth based on user-specified cutoff frequency */
|
||||
int fbw_coeffs;
|
||||
fbw_coeffs = s->cutoff * 2 * AC3_MAX_COEFS / s->sample_rate;
|
||||
bw_code = av_clip((fbw_coeffs - 73) / 3, 0, 60);
|
||||
s->bandwidth_code = av_clip((fbw_coeffs - 73) / 3, 0, 60);
|
||||
} else {
|
||||
/* use default bandwidth setting */
|
||||
bw_code = ac3_bandwidth_tab[s->fbw_channels-1][s->bit_alloc.sr_code][s->frame_size_code/2];
|
||||
s->bandwidth_code = ac3_bandwidth_tab[s->fbw_channels-1][s->bit_alloc.sr_code][s->frame_size_code/2];
|
||||
}
|
||||
|
||||
/* set number of coefficients for each channel */
|
||||
for (ch = 0; ch < s->fbw_channels; ch++) {
|
||||
s->bandwidth_code[ch] = bw_code;
|
||||
s->nb_coefs[ch] = bw_code * 3 + 73;
|
||||
s->nb_coefs[ch] = s->bandwidth_code * 3 + 73;
|
||||
}
|
||||
if (s->lfe_on)
|
||||
s->nb_coefs[s->lfe_channel] = 7; /* LFE channel always has 7 coefs */
|
||||
@ -2220,8 +2190,6 @@ static av_cold int ac3_encode_init(AVCodecContext *avctx)
|
||||
|
||||
set_bandwidth(s);
|
||||
|
||||
rematrixing_init(s);
|
||||
|
||||
exponent_init(s);
|
||||
|
||||
bit_alloc_init(s);
|
||||
|
@ -271,6 +271,42 @@ static inline unsigned char adpcm_ima_compress_sample(ADPCMChannelStatus *c, sho
|
||||
return nibble;
|
||||
}
|
||||
|
||||
static inline unsigned char adpcm_ima_qt_compress_sample(ADPCMChannelStatus *c, short sample)
|
||||
{
|
||||
int delta = sample - c->prev_sample;
|
||||
int diff, step = step_table[c->step_index];
|
||||
int nibble = 8*(delta < 0);
|
||||
|
||||
delta= abs(delta);
|
||||
diff = delta + (step >> 3);
|
||||
|
||||
if (delta >= step) {
|
||||
nibble |= 4;
|
||||
delta -= step;
|
||||
}
|
||||
step >>= 1;
|
||||
if (delta >= step) {
|
||||
nibble |= 2;
|
||||
delta -= step;
|
||||
}
|
||||
step >>= 1;
|
||||
if (delta >= step) {
|
||||
nibble |= 1;
|
||||
delta -= step;
|
||||
}
|
||||
diff -= delta;
|
||||
|
||||
if (nibble & 8)
|
||||
c->prev_sample -= diff;
|
||||
else
|
||||
c->prev_sample += diff;
|
||||
|
||||
c->prev_sample = av_clip_int16(c->prev_sample);
|
||||
c->step_index = av_clip(c->step_index + index_table[nibble], 0, 88);
|
||||
|
||||
return nibble;
|
||||
}
|
||||
|
||||
static inline unsigned char adpcm_ms_compress_sample(ADPCMChannelStatus *c, short sample)
|
||||
{
|
||||
int predictor, nibble, bias;
|
||||
@ -604,16 +640,14 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
|
||||
adpcm_compress_trellis(avctx, samples+ch, buf, &c->status[ch], 64);
|
||||
for(i=0; i<64; i++)
|
||||
put_bits(&pb, 4, buf[i^1]);
|
||||
c->status[ch].prev_sample = c->status[ch].predictor & ~0x7F;
|
||||
} else {
|
||||
for (i=0; i<64; i+=2){
|
||||
int t1, t2;
|
||||
t1 = adpcm_ima_compress_sample(&c->status[ch], samples[avctx->channels*(i+0)+ch]);
|
||||
t2 = adpcm_ima_compress_sample(&c->status[ch], samples[avctx->channels*(i+1)+ch]);
|
||||
t1 = adpcm_ima_qt_compress_sample(&c->status[ch], samples[avctx->channels*(i+0)+ch]);
|
||||
t2 = adpcm_ima_qt_compress_sample(&c->status[ch], samples[avctx->channels*(i+1)+ch]);
|
||||
put_bits(&pb, 4, t2);
|
||||
put_bits(&pb, 4, t1);
|
||||
}
|
||||
c->status[ch].prev_sample &= ~0x7F;
|
||||
}
|
||||
}
|
||||
|
||||
@ -808,6 +842,32 @@ static inline short adpcm_ima_expand_nibble(ADPCMChannelStatus *c, char nibble,
|
||||
return (short)c->predictor;
|
||||
}
|
||||
|
||||
static inline int adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble, int shift)
|
||||
{
|
||||
int step_index;
|
||||
int predictor;
|
||||
int diff, step;
|
||||
|
||||
step = step_table[c->step_index];
|
||||
step_index = c->step_index + index_table[nibble];
|
||||
step_index = av_clip(step_index, 0, 88);
|
||||
|
||||
diff = step >> 3;
|
||||
if (nibble & 4) diff += step;
|
||||
if (nibble & 2) diff += step >> 1;
|
||||
if (nibble & 1) diff += step >> 2;
|
||||
|
||||
if (nibble & 8)
|
||||
predictor = c->predictor - diff;
|
||||
else
|
||||
predictor = c->predictor + diff;
|
||||
|
||||
c->predictor = av_clip_int16(predictor);
|
||||
c->step_index = step_index;
|
||||
|
||||
return c->predictor;
|
||||
}
|
||||
|
||||
static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, char nibble)
|
||||
{
|
||||
int predictor;
|
||||
@ -1010,35 +1070,41 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
|
||||
case CODEC_ID_ADPCM_IMA_QT:
|
||||
n = buf_size - 2*avctx->channels;
|
||||
for (channel = 0; channel < avctx->channels; channel++) {
|
||||
int16_t predictor;
|
||||
int step_index;
|
||||
cs = &(c->status[channel]);
|
||||
/* (pppppp) (piiiiiii) */
|
||||
|
||||
/* Bits 15-7 are the _top_ 9 bits of the 16-bit initial predictor value */
|
||||
cs->predictor = (*src++) << 8;
|
||||
cs->predictor |= (*src & 0x80);
|
||||
cs->predictor &= 0xFF80;
|
||||
predictor = AV_RB16(src);
|
||||
step_index = predictor & 0x7F;
|
||||
predictor &= 0xFF80;
|
||||
|
||||
/* sign extension */
|
||||
if(cs->predictor & 0x8000)
|
||||
cs->predictor -= 0x10000;
|
||||
src += 2;
|
||||
|
||||
cs->predictor = av_clip_int16(cs->predictor);
|
||||
|
||||
cs->step_index = (*src++) & 0x7F;
|
||||
if (cs->step_index == step_index) {
|
||||
int diff = (int)predictor - cs->predictor;
|
||||
if (diff < 0)
|
||||
diff = - diff;
|
||||
if (diff > 0x7f)
|
||||
goto update;
|
||||
} else {
|
||||
update:
|
||||
cs->step_index = step_index;
|
||||
cs->predictor = predictor;
|
||||
}
|
||||
|
||||
if (cs->step_index > 88){
|
||||
av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
|
||||
cs->step_index = 88;
|
||||
}
|
||||
|
||||
cs->step = step_table[cs->step_index];
|
||||
|
||||
samples = (short*)data + channel;
|
||||
|
||||
for(m=32; n>0 && m>0; n--, m--) { /* in QuickTime, IMA is encoded by chuncks of 34 bytes (=64 samples) */
|
||||
*samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3);
|
||||
*samples = adpcm_ima_qt_expand_nibble(cs, src[0] & 0x0F, 3);
|
||||
samples += avctx->channels;
|
||||
*samples = adpcm_ima_expand_nibble(cs, src[0] >> 4 , 3);
|
||||
*samples = adpcm_ima_qt_expand_nibble(cs, src[0] >> 4 , 3);
|
||||
samples += avctx->channels;
|
||||
src ++;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ static void calc_predictor_params(AlacEncodeContext *s, int ch)
|
||||
s->min_prediction_order,
|
||||
s->max_prediction_order,
|
||||
ALAC_MAX_LPC_PRECISION, coefs, shift,
|
||||
AV_LPC_TYPE_LEVINSON, 0,
|
||||
FF_LPC_TYPE_LEVINSON, 0,
|
||||
ORDER_METHOD_EST, ALAC_MAX_LPC_SHIFT, 1);
|
||||
|
||||
s->lpc[ch].lpc_order = opt_order;
|
||||
@ -457,7 +457,7 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
|
||||
|
||||
s->avctx = avctx;
|
||||
ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size, s->max_prediction_order,
|
||||
AV_LPC_TYPE_LEVINSON);
|
||||
FF_LPC_TYPE_LEVINSON);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void avcodec_register_all(void)
|
||||
REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2);
|
||||
REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);
|
||||
REGISTER_DECODER (MSRLE, msrle);
|
||||
REGISTER_DECODER (MSVIDEO1, msvideo1);
|
||||
REGISTER_ENCDEC (MSVIDEO1, msvideo1);
|
||||
REGISTER_DECODER (MSZH, mszh);
|
||||
REGISTER_DECODER (MXPEG, mxpeg);
|
||||
REGISTER_DECODER (NUV, nuv);
|
||||
@ -184,6 +184,7 @@ void avcodec_register_all(void)
|
||||
REGISTER_ENCDEC (RV20, rv20);
|
||||
REGISTER_DECODER (RV30, rv30);
|
||||
REGISTER_DECODER (RV40, rv40);
|
||||
REGISTER_DECODER (S302M, s302m);
|
||||
REGISTER_ENCDEC (SGI, sgi);
|
||||
REGISTER_DECODER (SMACKER, smacker);
|
||||
REGISTER_DECODER (SMC, smc);
|
||||
|
@ -270,9 +270,9 @@ static void put_pixels16_axp_asm(uint8_t *block, const uint8_t *pixels,
|
||||
|
||||
void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
|
||||
{
|
||||
const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
|
||||
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
|
||||
|
||||
if (!h264_high_depth) {
|
||||
if (!high_bit_depth) {
|
||||
c->put_pixels_tab[0][0] = put_pixels16_axp_asm;
|
||||
c->put_pixels_tab[0][1] = put_pixels16_x2_axp;
|
||||
c->put_pixels_tab[0][2] = put_pixels16_y2_axp;
|
||||
|
@ -46,7 +46,7 @@
|
||||
/* 0: all entries 0, 1: only first entry nonzero, 2: otherwise */
|
||||
static inline int idct_row(DCTELEM *row)
|
||||
{
|
||||
int_fast32_t a0, a1, a2, a3, b0, b1, b2, b3, t;
|
||||
int a0, a1, a2, a3, b0, b1, b2, b3, t;
|
||||
uint64_t l, r, t2;
|
||||
l = ldq(row);
|
||||
r = ldq(row + 4);
|
||||
@ -154,7 +154,7 @@ static inline int idct_row(DCTELEM *row)
|
||||
|
||||
static inline void idct_col(DCTELEM *col)
|
||||
{
|
||||
int_fast32_t a0, a1, a2, a3, b0, b1, b2, b3;
|
||||
int a0, a1, a2, a3, b0, b1, b2, b3;
|
||||
|
||||
col[0] += (1 << (COL_SHIFT - 1)) / W4;
|
||||
|
||||
@ -235,7 +235,7 @@ static inline void idct_col2(DCTELEM *col)
|
||||
uint64_t l, r;
|
||||
|
||||
for (i = 0; i < 8; ++i) {
|
||||
int_fast32_t a0 = col[i] + (1 << (COL_SHIFT - 1)) / W4;
|
||||
int a0 = col[i] + (1 << (COL_SHIFT - 1)) / W4;
|
||||
|
||||
a0 *= W4;
|
||||
col[i] = a0 >> COL_SHIFT;
|
||||
|
@ -44,6 +44,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
if (avctx->extradata_size != 16*8 + 4*256)
|
||||
return -1;
|
||||
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
s->frame.reference = 1;
|
||||
|
||||
buf = avctx->extradata + 16*8;
|
||||
|
@ -81,6 +81,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
s->fg = DEFAULT_FG_COLOR;
|
||||
s->bg = DEFAULT_BG_COLOR;
|
||||
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
if (!avctx->width || !avctx->height)
|
||||
avcodec_set_dimensions(avctx, 80<<3, 25<<4);
|
||||
|
||||
@ -226,7 +227,7 @@ static int execute_code(AVCodecContext * avctx, int c)
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return ret;
|
||||
}
|
||||
s->frame.pict_type = FF_I_TYPE;
|
||||
s->frame.pict_type = AV_PICTURE_TYPE_I;
|
||||
s->frame.palette_has_changed = 1;
|
||||
memcpy(s->frame.data[1], ff_cga_palette, 16 * 4);
|
||||
erase_screen(avctx);
|
||||
@ -323,7 +324,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return ret;
|
||||
}
|
||||
s->frame.pict_type = FF_I_TYPE;
|
||||
s->frame.pict_type = AV_PICTURE_TYPE_I;
|
||||
s->frame.palette_has_changed = 1;
|
||||
memcpy(s->frame.data[1], ff_cga_palette, 16 * 4);
|
||||
|
||||
|
@ -79,5 +79,5 @@ function ff_ac3_bit_alloc_calc_bap_armv6, export=1
|
||||
ldr r0, [sp, #12]
|
||||
mov r1, #0
|
||||
mov r2, #256
|
||||
b memset
|
||||
b X(memset)
|
||||
endfunc
|
||||
|
@ -75,7 +75,7 @@ static void simple_idct_arm_add(uint8_t *dest, int line_size, DCTELEM *block)
|
||||
|
||||
void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
|
||||
{
|
||||
const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
|
||||
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
|
||||
|
||||
ff_put_pixels_clamped = c->put_pixels_clamped;
|
||||
ff_add_pixels_clamped = c->add_pixels_clamped;
|
||||
@ -97,7 +97,7 @@ void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
|
||||
|
||||
c->add_pixels_clamped = ff_add_pixels_clamped_arm;
|
||||
|
||||
if (!h264_high_depth) {
|
||||
if (!high_bit_depth) {
|
||||
c->put_pixels_tab[0][0] = ff_put_pixels16_arm;
|
||||
c->put_pixels_tab[0][1] = ff_put_pixels16_x2_arm;
|
||||
c->put_pixels_tab[0][2] = ff_put_pixels16_y2_arm;
|
||||
|
@ -72,7 +72,7 @@ int ff_pix_sum_armv6(uint8_t *pix, int line_size);
|
||||
|
||||
void av_cold ff_dsputil_init_armv6(DSPContext* c, AVCodecContext *avctx)
|
||||
{
|
||||
const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
|
||||
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
|
||||
|
||||
if (!avctx->lowres && (avctx->idct_algo == FF_IDCT_AUTO ||
|
||||
avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) {
|
||||
@ -82,7 +82,7 @@ void av_cold ff_dsputil_init_armv6(DSPContext* c, AVCodecContext *avctx)
|
||||
c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM;
|
||||
}
|
||||
|
||||
if (!h264_high_depth) {
|
||||
if (!high_bit_depth) {
|
||||
c->put_pixels_tab[0][0] = ff_put_pixels16_armv6;
|
||||
c->put_pixels_tab[0][1] = ff_put_pixels16_x2_armv6;
|
||||
c->put_pixels_tab[0][2] = ff_put_pixels16_y2_armv6;
|
||||
|
@ -173,7 +173,7 @@ void ff_apply_window_int16_neon(int16_t *dst, const int16_t *src,
|
||||
|
||||
void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
|
||||
{
|
||||
const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
|
||||
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
|
||||
|
||||
if (!avctx->lowres) {
|
||||
if (avctx->idct_algo == FF_IDCT_AUTO ||
|
||||
@ -192,7 +192,7 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
|
||||
}
|
||||
}
|
||||
|
||||
if (!h264_high_depth) {
|
||||
if (!high_bit_depth) {
|
||||
c->clear_block = ff_clear_block_neon;
|
||||
c->clear_blocks = ff_clear_blocks_neon;
|
||||
|
||||
@ -223,7 +223,7 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
|
||||
c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon;
|
||||
|
||||
if (CONFIG_H264_DECODER) {
|
||||
if (!h264_high_depth) {
|
||||
if (!high_bit_depth) {
|
||||
c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_neon;
|
||||
c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_neon;
|
||||
c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_neon;
|
||||
|
@ -155,7 +155,7 @@ static void nop(uint8_t *block, const uint8_t *pixels, int line_size, int h)
|
||||
void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx)
|
||||
{
|
||||
int mm_flags = AV_CPU_FLAG_IWMMXT; /* multimedia extension flags */
|
||||
const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
|
||||
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
|
||||
|
||||
if (avctx->dsp_mask) {
|
||||
if (avctx->dsp_mask & AV_CPU_FLAG_FORCE)
|
||||
@ -168,7 +168,7 @@ void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx)
|
||||
|
||||
c->add_pixels_clamped = add_pixels_clamped_iwmmxt;
|
||||
|
||||
if (!h264_high_depth) {
|
||||
if (!high_bit_depth) {
|
||||
c->clear_blocks = clear_blocks_iwmmxt;
|
||||
|
||||
c->put_pixels_tab[0][0] = put_pixels16_iwmmxt;
|
||||
|
@ -74,7 +74,7 @@ static void ff_h264_pred_init_neon(H264PredContext *h, int codec_id, const int b
|
||||
h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_neon;
|
||||
}
|
||||
|
||||
void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, const int bit_depth)
|
||||
void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, int bit_depth)
|
||||
{
|
||||
if (HAVE_NEON) ff_h264_pred_init_neon(h, codec_id, bit_depth);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ function ff_decode_block_coeffs_armv6, export=1
|
||||
rac_get_prob r5, r6, r7, r8, r0, r9, r10
|
||||
mov r9, #8
|
||||
addge r12, r12, #1
|
||||
movrel r4, ff_vp8_dct_cat_prob
|
||||
movrel r4, X(ff_vp8_dct_cat_prob)
|
||||
lsl r9, r9, r12
|
||||
ldr r4, [r4, r12, lsl #2]
|
||||
add r12, r9, #3
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "ass.h"
|
||||
#include "libavutil/avstring.h"
|
||||
|
||||
int ff_ass_subtitle_header(AVCodecContext *avctx,
|
||||
const char *font, int font_size,
|
||||
@ -97,8 +98,7 @@ int ff_ass_add_rect(AVSubtitle *sub, const char *dialog,
|
||||
rects[sub->num_rects]->type = SUBTITLE_ASS;
|
||||
rects[sub->num_rects]->ass = av_malloc(len + dlen + 1);
|
||||
strcpy (rects[sub->num_rects]->ass , header);
|
||||
strncpy(rects[sub->num_rects]->ass + len, dialog, dlen);
|
||||
rects[sub->num_rects]->ass[len+dlen] = 0;
|
||||
av_strlcpy(rects[sub->num_rects]->ass + len, dialog, dlen + 1);
|
||||
sub->num_rects++;
|
||||
return dlen;
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return -1;
|
||||
}
|
||||
p->pict_type= FF_I_TYPE;
|
||||
p->pict_type= AV_PICTURE_TYPE_I;
|
||||
p->key_frame= 1;
|
||||
|
||||
av_fast_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
@ -470,7 +470,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
|
||||
init_put_bits(&a->pb, buf, buf_size);
|
||||
|
||||
*p = *pict;
|
||||
p->pict_type= FF_I_TYPE;
|
||||
p->pict_type= AV_PICTURE_TYPE_I;
|
||||
p->key_frame= 1;
|
||||
|
||||
for(mb_y=0; mb_y<a->mb_height2; mb_y++){
|
||||
|
@ -39,6 +39,7 @@ static av_cold int aura_decode_init(AVCodecContext *avctx)
|
||||
if (avctx->width & 0x3)
|
||||
return -1;
|
||||
avctx->pix_fmt = PIX_FMT_YUV422P;
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -241,6 +241,7 @@ enum CodecID {
|
||||
CODEC_ID_PCM_F64LE,
|
||||
CODEC_ID_PCM_BLURAY,
|
||||
CODEC_ID_PCM_LXF,
|
||||
CODEC_ID_S302M,
|
||||
|
||||
/* various ADPCM codecs */
|
||||
CODEC_ID_ADPCM_IMA_QT= 0x11000,
|
||||
@ -537,10 +538,11 @@ enum AVChromaLocation{
|
||||
AVCHROMA_LOC_NB , ///< Not part of ABI
|
||||
};
|
||||
|
||||
#if FF_API_FLAC_GLOBAL_OPTS
|
||||
/**
|
||||
* LPC analysis type
|
||||
*/
|
||||
enum AVLPCType {
|
||||
attribute_deprecated enum AVLPCType {
|
||||
AV_LPC_TYPE_DEFAULT = -1, ///< use the codec default LPC type
|
||||
AV_LPC_TYPE_NONE = 0, ///< do not use LPC prediction or use all zero coefficients
|
||||
AV_LPC_TYPE_FIXED = 1, ///< fixed LPC coefficients
|
||||
@ -548,6 +550,7 @@ enum AVLPCType {
|
||||
AV_LPC_TYPE_CHOLESKY = 3, ///< Cholesky factorization
|
||||
AV_LPC_TYPE_NB , ///< Not part of ABI
|
||||
};
|
||||
#endif
|
||||
|
||||
enum AVAudioServiceType {
|
||||
AV_AUDIO_SERVICE_TYPE_MAIN = 0,
|
||||
@ -1025,6 +1028,36 @@ typedef struct AVPanScan{
|
||||
* - decoding: set by libavcodec, read by user.\
|
||||
*/\
|
||||
int64_t best_effort_timestamp;\
|
||||
\
|
||||
/**\
|
||||
* reordered pos from the last AVPacket that has been input into the decoder\
|
||||
* - encoding: unused\
|
||||
* - decoding: Read by user.\
|
||||
*/\
|
||||
int64_t pkt_pos;\
|
||||
\
|
||||
/**\
|
||||
* reordered sample aspect ratio for the video frame, 0/1 if unknown\unspecified
|
||||
* - encoding: unused\
|
||||
* - decoding: Read by user.\
|
||||
*/\
|
||||
AVRational sample_aspect_ratio;\
|
||||
\
|
||||
/**\
|
||||
* width and height of the video frame\
|
||||
* - encoding: unused\
|
||||
* - decoding: Read by user.\
|
||||
*/\
|
||||
int width, height;\
|
||||
\
|
||||
/**\
|
||||
* format of the frame, -1 if unknown or unset\
|
||||
* It should be cast to the corresponding enum (enum PixelFormat\
|
||||
* for video, enum AVSampleFormat for audio)\
|
||||
* - encoding: unused\
|
||||
* - decoding: Read by user.\
|
||||
*/\
|
||||
int format;\
|
||||
|
||||
|
||||
#define FF_QSCALE_TYPE_MPEG1 0
|
||||
@ -2561,7 +2594,6 @@ typedef struct AVCodecContext {
|
||||
* @deprecated Deprecated in favor of lpc_type and lpc_passes.
|
||||
*/
|
||||
int use_lpc;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LPC coefficient precision - used by FLAC encoder
|
||||
@ -2569,6 +2601,7 @@ typedef struct AVCodecContext {
|
||||
* - decoding: unused
|
||||
*/
|
||||
int lpc_coeff_precision;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* - encoding: Set by user.
|
||||
@ -2582,24 +2615,35 @@ typedef struct AVCodecContext {
|
||||
*/
|
||||
int max_prediction_order;
|
||||
|
||||
#if FF_API_FLAC_GLOBAL_OPTS
|
||||
/**
|
||||
* @defgroup flac_opts FLAC options
|
||||
* @deprecated Use FLAC encoder private options instead.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* search method for selecting prediction order
|
||||
* - encoding: Set by user.
|
||||
* - decoding: unused
|
||||
*/
|
||||
int prediction_order_method;
|
||||
attribute_deprecated int prediction_order_method;
|
||||
|
||||
/**
|
||||
* - encoding: Set by user.
|
||||
* - decoding: unused
|
||||
*/
|
||||
int min_partition_order;
|
||||
attribute_deprecated int min_partition_order;
|
||||
|
||||
/**
|
||||
* - encoding: Set by user.
|
||||
* - decoding: unused
|
||||
*/
|
||||
int max_partition_order;
|
||||
attribute_deprecated int max_partition_order;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif
|
||||
|
||||
/**
|
||||
* GOP timecode frame start number, in non drop frame format
|
||||
@ -2817,19 +2861,21 @@ typedef struct AVCodecContext {
|
||||
|
||||
int log_level_offset;
|
||||
|
||||
#if FF_API_FLAC_GLOBAL_OPTS
|
||||
/**
|
||||
* Determines which LPC analysis algorithm to use.
|
||||
* - encoding: Set by user
|
||||
* - decoding: unused
|
||||
*/
|
||||
enum AVLPCType lpc_type;
|
||||
attribute_deprecated enum AVLPCType lpc_type;
|
||||
|
||||
/**
|
||||
* Number of passes to use for Cholesky factorization during LPC analysis
|
||||
* - encoding: Set by user
|
||||
* - decoding: unused
|
||||
*/
|
||||
int lpc_passes;
|
||||
attribute_deprecated int lpc_passes;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Number of slices.
|
||||
@ -4059,7 +4105,7 @@ typedef struct AVCodecParserContext {
|
||||
/*!
|
||||
* Set by parser to 1 for key frames and 0 for non-key frames.
|
||||
* It is initialized to -1, so if the parser doesn't set this flag,
|
||||
* old-style fallback using FF_I_TYPE picture type as key frames
|
||||
* old-style fallback using AV_PICTURE_TYPE_I picture type as key frames
|
||||
* will be used.
|
||||
*/
|
||||
int key_frame;
|
||||
|
@ -63,7 +63,7 @@ avs_decode_frame(AVCodecContext * avctx,
|
||||
return -1;
|
||||
}
|
||||
p->reference = 1;
|
||||
p->pict_type = FF_P_TYPE;
|
||||
p->pict_type = AV_PICTURE_TYPE_P;
|
||||
p->key_frame = 0;
|
||||
|
||||
out = avs->picture.data[0];
|
||||
@ -93,7 +93,7 @@ avs_decode_frame(AVCodecContext * avctx,
|
||||
|
||||
switch (sub_type) {
|
||||
case AVS_I_FRAME:
|
||||
p->pict_type = FF_I_TYPE;
|
||||
p->pict_type = AV_PICTURE_TYPE_I;
|
||||
p->key_frame = 1;
|
||||
case AVS_P_FRAME_3X3:
|
||||
vect_w = 3;
|
||||
@ -146,7 +146,9 @@ avs_decode_frame(AVCodecContext * avctx,
|
||||
|
||||
static av_cold int avs_decode_init(AVCodecContext * avctx)
|
||||
{
|
||||
AvsContext *const avs = avctx->priv_data;
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
avcodec_get_frame_defaults(&avs->picture);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ typedef struct BethsoftvidContext {
|
||||
static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
BethsoftvidContext *vid = avctx->priv_data;
|
||||
avcodec_get_frame_defaults(&vid->frame);
|
||||
vid->frame.reference = 1;
|
||||
vid->frame.buffer_hints = FF_BUFFER_HINTS_VALID |
|
||||
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
|
||||
|
@ -41,6 +41,7 @@ static av_cold int bfi_decode_init(AVCodecContext * avctx)
|
||||
{
|
||||
BFIContext *bfi = avctx->priv_data;
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
avcodec_get_frame_defaults(&bfi->frame);
|
||||
bfi->dst = av_mallocz(avctx->width * avctx->height);
|
||||
return 0;
|
||||
}
|
||||
@ -69,7 +70,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
|
||||
|
||||
/* Set frame parameters and palette, if necessary */
|
||||
if (!avctx->frame_number) {
|
||||
bfi->frame.pict_type = FF_I_TYPE;
|
||||
bfi->frame.pict_type = AV_PICTURE_TYPE_I;
|
||||
bfi->frame.key_frame = 1;
|
||||
/* Setting the palette */
|
||||
if(avctx->extradata_size>768) {
|
||||
@ -89,7 +90,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
|
||||
memcpy(bfi->pal, bfi->frame.data[1], sizeof(bfi->pal));
|
||||
bfi->frame.palette_has_changed = 1;
|
||||
} else {
|
||||
bfi->frame.pict_type = FF_P_TYPE;
|
||||
bfi->frame.pict_type = AV_PICTURE_TYPE_P;
|
||||
bfi->frame.key_frame = 0;
|
||||
bfi->frame.palette_has_changed = 0;
|
||||
memcpy(bfi->frame.data[1], bfi->pal, sizeof(bfi->pal));
|
||||
|
@ -197,14 +197,14 @@ static int bfin_pix_abs8_xy2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_si
|
||||
|
||||
void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
|
||||
{
|
||||
const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
|
||||
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
|
||||
|
||||
c->get_pixels = ff_bfin_get_pixels;
|
||||
c->diff_pixels = ff_bfin_diff_pixels;
|
||||
c->put_pixels_clamped = ff_bfin_put_pixels_clamped;
|
||||
c->add_pixels_clamped = ff_bfin_add_pixels_clamped;
|
||||
|
||||
if (!h264_high_depth)
|
||||
if (!high_bit_depth)
|
||||
c->clear_blocks = bfin_clear_blocks;
|
||||
c->pix_sum = ff_bfin_pix_sum;
|
||||
c->pix_norm1 = ff_bfin_pix_norm1;
|
||||
@ -231,7 +231,7 @@ void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
|
||||
c->sse[1] = ff_bfin_sse8;
|
||||
c->sse[2] = ff_bfin_sse4;
|
||||
|
||||
if (!h264_high_depth) {
|
||||
if (!high_bit_depth) {
|
||||
c->put_pixels_tab[0][0] = bfin_put_pixels16;
|
||||
c->put_pixels_tab[0][1] = bfin_put_pixels16_x2;
|
||||
c->put_pixels_tab[0][2] = bfin_put_pixels16_y2;
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if CONFIG_MPEGAUDIO_HP
|
||||
#define MULH(X,Y) ({ int xxo; \
|
||||
__asm__ ( \
|
||||
"a1 = %2.L * %1.L (FU);\n\t" \
|
||||
@ -34,15 +33,6 @@
|
||||
"a1 = a1 >>> 16;\n\t" \
|
||||
"%0 = (a0 += a1);\n\t" \
|
||||
: "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; })
|
||||
#else
|
||||
#define MULH(X,Y) ({ int xxo; \
|
||||
__asm__ ( \
|
||||
"a1 = %2.H * %1.L (IS,M);\n\t" \
|
||||
"a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\
|
||||
"a1 = a1 >>> 16;\n\t" \
|
||||
"%0 = (a0 += a1);\n\t" \
|
||||
: "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; })
|
||||
#endif
|
||||
|
||||
/* signed 16x16 -> 32 multiply */
|
||||
#define MUL16(a, b) ({ int xxo; \
|
||||
|
@ -200,7 +200,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return -1;
|
||||
}
|
||||
p->pict_type = FF_I_TYPE;
|
||||
p->pict_type = AV_PICTURE_TYPE_I;
|
||||
p->key_frame = 1;
|
||||
|
||||
buf = buf0 + hsize;
|
||||
|
@ -74,7 +74,7 @@ static int bmp_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
|
||||
uint8_t *ptr;
|
||||
unsigned char* buf0 = buf;
|
||||
*p = *pict;
|
||||
p->pict_type= FF_I_TYPE;
|
||||
p->pict_type= AV_PICTURE_TYPE_I;
|
||||
p->key_frame= 1;
|
||||
switch (avctx->pix_fmt) {
|
||||
case PIX_FMT_RGB565:
|
||||
|
@ -47,6 +47,10 @@ typedef enum {
|
||||
|
||||
static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
C93DecoderContext * const c93 = avctx->priv_data;
|
||||
|
||||
avcodec_get_frame_defaults(&c93->pictures[0]);
|
||||
avcodec_get_frame_defaults(&c93->pictures[1]);
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
return 0;
|
||||
}
|
||||
@ -137,10 +141,10 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
stride = newpic->linesize[0];
|
||||
|
||||
if (buf[0] & C93_FIRST_FRAME) {
|
||||
newpic->pict_type = FF_I_TYPE;
|
||||
newpic->pict_type = AV_PICTURE_TYPE_I;
|
||||
newpic->key_frame = 1;
|
||||
} else {
|
||||
newpic->pict_type = FF_P_TYPE;
|
||||
newpic->pict_type = AV_PICTURE_TYPE_P;
|
||||
newpic->key_frame = 0;
|
||||
}
|
||||
|
||||
|
@ -233,15 +233,16 @@ extern const struct dec_2dvlc ff_cavs_chroma_dec[5];
|
||||
extern const uint8_t ff_cavs_chroma_qp[64];
|
||||
extern const uint8_t ff_cavs_scan3x3[4];
|
||||
extern const uint8_t ff_cavs_partition_flags[30];
|
||||
extern const int_fast8_t ff_left_modifier_l[8];
|
||||
extern const int_fast8_t ff_top_modifier_l[8];
|
||||
extern const int_fast8_t ff_left_modifier_c[7];
|
||||
extern const int_fast8_t ff_top_modifier_c[7];
|
||||
extern const int8_t ff_left_modifier_l[8];
|
||||
extern const int8_t ff_top_modifier_l[8];
|
||||
extern const int8_t ff_left_modifier_c[7];
|
||||
extern const int8_t ff_top_modifier_c[7];
|
||||
extern const cavs_vector ff_cavs_intra_mv;
|
||||
extern const cavs_vector ff_cavs_un_mv;
|
||||
extern const cavs_vector ff_cavs_dir_mv;
|
||||
|
||||
static inline void modify_pred(const int_fast8_t *mod_table, int *mode) {
|
||||
static inline void modify_pred(const int8_t *mod_table, int *mode)
|
||||
{
|
||||
*mode = mod_table[*mode];
|
||||
if(*mode < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n");
|
||||
@ -278,7 +279,7 @@ static inline void set_mv_intra(AVSContext *h) {
|
||||
set_mvs(&h->mv[MV_FWD_X0], BLK_16X16);
|
||||
h->mv[MV_BWD_X0] = ff_cavs_intra_mv;
|
||||
set_mvs(&h->mv[MV_BWD_X0], BLK_16X16);
|
||||
if(h->pic_type != FF_B_TYPE)
|
||||
if(h->pic_type != AV_PICTURE_TYPE_B)
|
||||
h->col_type_base[h->mbidx] = I_8X8;
|
||||
}
|
||||
|
||||
|
@ -497,9 +497,9 @@ static const uint8_t tc_tab[64] = {
|
||||
5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9
|
||||
};
|
||||
|
||||
const int_fast8_t ff_left_modifier_l[8] = { 0,-1, 6,-1,-1, 7, 6, 7};
|
||||
const int_fast8_t ff_top_modifier_l[8] = {-1, 1, 5,-1,-1, 5, 7, 7};
|
||||
const int_fast8_t ff_left_modifier_c[7] = { 5,-1, 2,-1, 6, 5, 6};
|
||||
const int_fast8_t ff_top_modifier_c[7] = { 4, 1,-1,-1, 4, 6, 6};
|
||||
const int8_t ff_left_modifier_l[8] = { 0, -1, 6, -1, -1, 7, 6, 7 };
|
||||
const int8_t ff_top_modifier_l[8] = { -1, 1, 5, -1, -1, 5, 7, 7 };
|
||||
const int8_t ff_left_modifier_c[7] = { 5, -1, 2, -1, 6, 5, 6 };
|
||||
const int8_t ff_top_modifier_c[7] = { 4, 1, -1, -1, 4, 6, 6 };
|
||||
|
||||
#endif /* AVCODEC_CAVSDATA_H */
|
||||
|
@ -220,7 +220,7 @@ static int decode_mb_i(AVSContext *h, int cbp_code) {
|
||||
ff_cavs_modify_mb_i(h, &pred_mode_uv);
|
||||
|
||||
/* get coded block pattern */
|
||||
if(h->pic_type == FF_I_TYPE)
|
||||
if(h->pic_type == AV_PICTURE_TYPE_I)
|
||||
cbp_code = get_ue_golomb(gb);
|
||||
if(cbp_code > 63){
|
||||
av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra cbp\n");
|
||||
@ -424,7 +424,7 @@ static inline int decode_slice_header(AVSContext *h, GetBitContext *gb) {
|
||||
h->qp = get_bits(gb,6);
|
||||
}
|
||||
/* inter frame or second slice can have weighting params */
|
||||
if((h->pic_type != FF_I_TYPE) || (!h->pic_structure && h->mby >= h->mb_width/2))
|
||||
if((h->pic_type != AV_PICTURE_TYPE_I) || (!h->pic_structure && h->mby >= h->mb_width/2))
|
||||
if(get_bits1(gb)) { //slice_weighting_flag
|
||||
av_log(h->s.avctx, AV_LOG_ERROR,
|
||||
"weighted prediction not yet supported\n");
|
||||
@ -470,17 +470,17 @@ static int decode_pic(AVSContext *h) {
|
||||
}
|
||||
skip_bits(&s->gb,16);//bbv_dwlay
|
||||
if(h->stc == PIC_PB_START_CODE) {
|
||||
h->pic_type = get_bits(&s->gb,2) + FF_I_TYPE;
|
||||
if(h->pic_type > FF_B_TYPE) {
|
||||
h->pic_type = get_bits(&s->gb,2) + AV_PICTURE_TYPE_I;
|
||||
if(h->pic_type > AV_PICTURE_TYPE_B) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "illegal picture type\n");
|
||||
return -1;
|
||||
}
|
||||
/* make sure we have the reference frames we need */
|
||||
if(!h->DPB[0].data[0] ||
|
||||
(!h->DPB[1].data[0] && h->pic_type == FF_B_TYPE))
|
||||
(!h->DPB[1].data[0] && h->pic_type == AV_PICTURE_TYPE_B))
|
||||
return -1;
|
||||
} else {
|
||||
h->pic_type = FF_I_TYPE;
|
||||
h->pic_type = AV_PICTURE_TYPE_I;
|
||||
if(get_bits1(&s->gb))
|
||||
skip_bits(&s->gb,24);//time_code
|
||||
/* old sample clips were all progressive and no low_delay,
|
||||
@ -502,7 +502,7 @@ static int decode_pic(AVSContext *h) {
|
||||
h->picture.poc = get_bits(&s->gb,8)*2;
|
||||
|
||||
/* get temporal distances and MV scaling factors */
|
||||
if(h->pic_type != FF_B_TYPE) {
|
||||
if(h->pic_type != AV_PICTURE_TYPE_B) {
|
||||
h->dist[0] = (h->picture.poc - h->DPB[0].poc + 512) % 512;
|
||||
} else {
|
||||
h->dist[0] = (h->DPB[0].poc - h->picture.poc + 512) % 512;
|
||||
@ -510,7 +510,7 @@ static int decode_pic(AVSContext *h) {
|
||||
h->dist[1] = (h->picture.poc - h->DPB[1].poc + 512) % 512;
|
||||
h->scale_den[0] = h->dist[0] ? 512/h->dist[0] : 0;
|
||||
h->scale_den[1] = h->dist[1] ? 512/h->dist[1] : 0;
|
||||
if(h->pic_type == FF_B_TYPE) {
|
||||
if(h->pic_type == AV_PICTURE_TYPE_B) {
|
||||
h->sym_factor = h->dist[0]*h->scale_den[1];
|
||||
} else {
|
||||
h->direct_den[0] = h->dist[0] ? 16384/h->dist[0] : 0;
|
||||
@ -529,12 +529,12 @@ static int decode_pic(AVSContext *h) {
|
||||
skip_bits1(&s->gb); //repeat_first_field
|
||||
h->qp_fixed = get_bits1(&s->gb);
|
||||
h->qp = get_bits(&s->gb,6);
|
||||
if(h->pic_type == FF_I_TYPE) {
|
||||
if(h->pic_type == AV_PICTURE_TYPE_I) {
|
||||
if(!h->progressive && !h->pic_structure)
|
||||
skip_bits1(&s->gb);//what is this?
|
||||
skip_bits(&s->gb,4); //reserved bits
|
||||
} else {
|
||||
if(!(h->pic_type == FF_B_TYPE && h->pic_structure == 1))
|
||||
if(!(h->pic_type == AV_PICTURE_TYPE_B && h->pic_structure == 1))
|
||||
h->ref_flag = get_bits1(&s->gb);
|
||||
skip_bits(&s->gb,4); //reserved bits
|
||||
h->skip_mode_flag = get_bits1(&s->gb);
|
||||
@ -546,12 +546,12 @@ static int decode_pic(AVSContext *h) {
|
||||
} else {
|
||||
h->alpha_offset = h->beta_offset = 0;
|
||||
}
|
||||
if(h->pic_type == FF_I_TYPE) {
|
||||
if(h->pic_type == AV_PICTURE_TYPE_I) {
|
||||
do {
|
||||
check_for_slice(h);
|
||||
decode_mb_i(h, 0);
|
||||
} while(ff_cavs_next_mb(h));
|
||||
} else if(h->pic_type == FF_P_TYPE) {
|
||||
} else if(h->pic_type == AV_PICTURE_TYPE_P) {
|
||||
do {
|
||||
if(check_for_slice(h))
|
||||
skip_count = -1;
|
||||
@ -567,7 +567,7 @@ static int decode_pic(AVSContext *h) {
|
||||
decode_mb_p(h,mb_type);
|
||||
}
|
||||
} while(ff_cavs_next_mb(h));
|
||||
} else { /* FF_B_TYPE */
|
||||
} else { /* AV_PICTURE_TYPE_B */
|
||||
do {
|
||||
if(check_for_slice(h))
|
||||
skip_count = -1;
|
||||
@ -584,7 +584,7 @@ static int decode_pic(AVSContext *h) {
|
||||
}
|
||||
} while(ff_cavs_next_mb(h));
|
||||
}
|
||||
if(h->pic_type != FF_B_TYPE) {
|
||||
if(h->pic_type != AV_PICTURE_TYPE_B) {
|
||||
if(h->DPB[1].data[0])
|
||||
s->avctx->release_buffer(s->avctx, (AVFrame *)&h->DPB[1]);
|
||||
h->DPB[1] = h->DPB[0];
|
||||
@ -684,7 +684,7 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size,
|
||||
if(decode_pic(h))
|
||||
break;
|
||||
*data_size = sizeof(AVPicture);
|
||||
if(h->pic_type != FF_B_TYPE) {
|
||||
if(h->pic_type != AV_PICTURE_TYPE_B) {
|
||||
if(h->DPB[1].data[0]) {
|
||||
*picture = *(AVFrame *) &h->DPB[1];
|
||||
} else {
|
||||
|
@ -403,6 +403,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx)
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
}
|
||||
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
s->frame.data[0] = NULL;
|
||||
|
||||
return 0;
|
||||
|
@ -64,7 +64,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return -1;
|
||||
}
|
||||
p->pict_type= FF_I_TYPE;
|
||||
p->pict_type= AV_PICTURE_TYPE_I;
|
||||
p->key_frame= 1;
|
||||
|
||||
init_get_bits(&a->gb, buf, buf_size);
|
||||
@ -100,7 +100,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
|
||||
int size;
|
||||
|
||||
*p = *pict;
|
||||
p->pict_type= FF_I_TYPE;
|
||||
p->pict_type= AV_PICTURE_TYPE_I;
|
||||
p->key_frame= 1;
|
||||
|
||||
emms_c();
|
||||
@ -118,6 +118,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
|
||||
static av_cold void common_init(AVCodecContext *avctx){
|
||||
CLJRContext * const a = avctx->priv_data;
|
||||
|
||||
avcodec_get_frame_defaults(&a->picture);
|
||||
avctx->coded_frame= (AVFrame*)&a->picture;
|
||||
a->avctx= avctx;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||
|
||||
// flip upside down, add difference frame
|
||||
if (buf[0] & 1) { // keyframe
|
||||
c->pic.pict_type = FF_I_TYPE;
|
||||
c->pic.pict_type = AV_PICTURE_TYPE_I;
|
||||
c->pic.key_frame = 1;
|
||||
switch (c->bpp) {
|
||||
case 16:
|
||||
@ -197,7 +197,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||
c->linelen, c->height);
|
||||
}
|
||||
} else {
|
||||
c->pic.pict_type = FF_P_TYPE;
|
||||
c->pic.pict_type = AV_PICTURE_TYPE_P;
|
||||
c->pic.key_frame = 0;
|
||||
switch (c->bpp) {
|
||||
case 16:
|
||||
@ -231,6 +231,7 @@ static av_cold int decode_init(AVCodecContext *avctx) {
|
||||
return 1;
|
||||
}
|
||||
c->bpp = avctx->bits_per_coded_sample;
|
||||
avcodec_get_frame_defaults(&c->pic);
|
||||
c->pic.data[0] = NULL;
|
||||
c->linelen = avctx->width * avctx->bits_per_coded_sample / 8;
|
||||
c->height = avctx->height;
|
||||
|
@ -53,6 +53,7 @@ static av_cold int cyuv_decode_init(AVCodecContext *avctx)
|
||||
return -1;
|
||||
s->height = avctx->height;
|
||||
avctx->pix_fmt = PIX_FMT_YUV411P;
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1622,6 +1622,7 @@ static int dca_decode_frame(AVCodecContext * avctx,
|
||||
{
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
int data_size_tmp;
|
||||
|
||||
int lfe_samples;
|
||||
int num_core_channels = 0;
|
||||
@ -1792,6 +1793,10 @@ static int dca_decode_frame(AVCodecContext * avctx,
|
||||
s->output = DCA_STEREO;
|
||||
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
}
|
||||
else if (avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE) {
|
||||
static const int8_t dca_channel_order_native[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
s->channel_order_tab = dca_channel_order_native;
|
||||
}
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n",s->amode);
|
||||
return -1;
|
||||
@ -1813,10 +1818,11 @@ static int dca_decode_frame(AVCodecContext * avctx,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ffdshow custom code */
|
||||
if (*data_size < (s->sample_blocks / 8) * 256 * sizeof(samples[0]) * channels)
|
||||
data_size_tmp = (s->sample_blocks / 8) * 256 * channels;
|
||||
data_size_tmp *= avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(*samples_flt) : sizeof(*samples);
|
||||
if (*data_size < data_size_tmp)
|
||||
return -1;
|
||||
*data_size = 256 / 8 * s->sample_blocks * sizeof(samples[0]) * channels;
|
||||
*data_size = data_size_tmp;
|
||||
|
||||
/* filter to get final output */
|
||||
for (i = 0; i < (s->sample_blocks / 8); i++) {
|
||||
|
@ -195,7 +195,7 @@ static inline void mmx_emms(void)
|
||||
|
||||
static void dct_error(const char *name, int is_idct,
|
||||
void (*fdct_func)(DCTELEM *block),
|
||||
void (*fdct_ref)(DCTELEM *block), int form, int test)
|
||||
void (*fdct_ref)(DCTELEM *block), int form, int test, const int bits)
|
||||
{
|
||||
int it, i, scale;
|
||||
int err_inf, v;
|
||||
@ -204,6 +204,7 @@ static void dct_error(const char *name, int is_idct,
|
||||
int maxout=0;
|
||||
int blockSumErrMax=0, blockSumErr;
|
||||
AVLFG prng;
|
||||
const int vals=1<<bits;
|
||||
|
||||
av_lfg_init(&prng, 1);
|
||||
|
||||
@ -216,7 +217,7 @@ static void dct_error(const char *name, int is_idct,
|
||||
switch(test){
|
||||
case 0:
|
||||
for(i=0;i<64;i++)
|
||||
block1[i] = (av_lfg_get(&prng) % 512) -256;
|
||||
block1[i] = (av_lfg_get(&prng) % (2*vals)) -vals;
|
||||
if (is_idct){
|
||||
ff_ref_fdct(block1);
|
||||
|
||||
@ -227,10 +228,10 @@ static void dct_error(const char *name, int is_idct,
|
||||
case 1:{
|
||||
int num = av_lfg_get(&prng) % 10 + 1;
|
||||
for(i=0;i<num;i++)
|
||||
block1[av_lfg_get(&prng) % 64] = av_lfg_get(&prng) % 512 -256;
|
||||
block1[av_lfg_get(&prng) % 64] = av_lfg_get(&prng) % (2*vals) -vals;
|
||||
}break;
|
||||
case 2:
|
||||
block1[0] = av_lfg_get(&prng) % 4096 - 2048;
|
||||
block1[0] = av_lfg_get(&prng) % (16*vals) - (8*vals);
|
||||
block1[63]= (block1[0]&1)^1;
|
||||
break;
|
||||
}
|
||||
@ -328,7 +329,7 @@ static void dct_error(const char *name, int is_idct,
|
||||
switch(test){
|
||||
case 0:
|
||||
for(i=0;i<64;i++)
|
||||
block1[i] = av_lfg_get(&prng) % 512 -256;
|
||||
block1[i] = av_lfg_get(&prng) % (2*vals) -vals;
|
||||
if (is_idct){
|
||||
ff_ref_fdct(block1);
|
||||
|
||||
@ -338,10 +339,10 @@ static void dct_error(const char *name, int is_idct,
|
||||
break;
|
||||
case 1:{
|
||||
case 2:
|
||||
block1[0] = av_lfg_get(&prng) % 512 -256;
|
||||
block1[1] = av_lfg_get(&prng) % 512 -256;
|
||||
block1[2] = av_lfg_get(&prng) % 512 -256;
|
||||
block1[3] = av_lfg_get(&prng) % 512 -256;
|
||||
block1[0] = av_lfg_get(&prng) % (2*vals) -vals;
|
||||
block1[1] = av_lfg_get(&prng) % (2*vals) -vals;
|
||||
block1[2] = av_lfg_get(&prng) % (2*vals) -vals;
|
||||
block1[3] = av_lfg_get(&prng) % (2*vals) -vals;
|
||||
}break;
|
||||
}
|
||||
|
||||
@ -552,6 +553,7 @@ int main(int argc, char **argv)
|
||||
int test_idct = 0, test_248_dct = 0;
|
||||
int c,i;
|
||||
int test=1;
|
||||
int bits=8;
|
||||
cpu_flags = av_get_cpu_flags();
|
||||
|
||||
ff_ref_dct_init();
|
||||
@ -582,6 +584,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if(optind <argc) test= atoi(argv[optind]);
|
||||
if(optind+1 < argc) bits= atoi(argv[optind+1]);
|
||||
|
||||
printf("ffmpeg DCT/IDCT test\n");
|
||||
|
||||
@ -590,7 +593,7 @@ int main(int argc, char **argv)
|
||||
} else {
|
||||
for (i=0;algos[i].name;i++)
|
||||
if (algos[i].is_idct == test_idct && !(~cpu_flags & algos[i].mm_support)) {
|
||||
dct_error (algos[i].name, algos[i].is_idct, algos[i].func, algos[i].ref, algos[i].format, test);
|
||||
dct_error (algos[i].name, algos[i].is_idct, algos[i].func, algos[i].ref, algos[i].format, test, bits);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -186,7 +186,6 @@ static int decode_dds1(uint8_t *frame, int width, int height,
|
||||
static int decode_bdlt(uint8_t *frame, int width, int height,
|
||||
const uint8_t *src, const uint8_t *src_end)
|
||||
{
|
||||
const uint8_t *frame_end = frame + width * height;
|
||||
uint8_t *line_ptr;
|
||||
int count, lines, segments;
|
||||
|
||||
|
@ -194,7 +194,7 @@ static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
avctx->has_b_frames = 1;
|
||||
}
|
||||
if (avctx->has_b_frames && s->pts == s->dts)
|
||||
s->pict_type = FF_B_TYPE;
|
||||
s->pict_type = AV_PICTURE_TYPE_B;
|
||||
|
||||
/* Finally have a complete Dirac data unit */
|
||||
*buf = pc->dirac_unit;
|
||||
|
@ -55,7 +55,8 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
|
||||
ctx->avctx = avctx;
|
||||
dsputil_init(&ctx->dsp, avctx);
|
||||
avctx->coded_frame = &ctx->picture;
|
||||
ctx->picture.type = FF_I_TYPE;
|
||||
avcodec_get_frame_defaults(&ctx->picture);
|
||||
ctx->picture.type = AV_PICTURE_TYPE_I;
|
||||
ctx->picture.key_frame = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
|
||||
|
||||
static const AVOption options[]={
|
||||
{"nitris_compat", "encode with Avid Nitris compatibility", offsetof(DNXHDEncContext, nitris_compat), FF_OPT_TYPE_INT, 0, 0, 1, VE},
|
||||
{"nitris_compat", "encode with Avid Nitris compatibility", offsetof(DNXHDEncContext, nitris_compat), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, VE},
|
||||
{NULL}
|
||||
};
|
||||
static const AVClass class = { "dnxhd", av_default_item_name, options, LIBAVUTIL_VERSION_INT };
|
||||
@ -222,7 +222,7 @@ static int dnxhd_encode_init(AVCodecContext *avctx)
|
||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_qscale, ctx->m.mb_num *sizeof(uint8_t) , fail);
|
||||
|
||||
ctx->frame.key_frame = 1;
|
||||
ctx->frame.pict_type = FF_I_TYPE;
|
||||
ctx->frame.pict_type = AV_PICTURE_TYPE_I;
|
||||
ctx->m.avctx->coded_frame = &ctx->frame;
|
||||
|
||||
if (avctx->thread_count > MAX_THREADS) {
|
||||
|
@ -35,7 +35,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
DPXContext *s = avctx->priv_data;
|
||||
|
||||
avctx->coded_frame = &s->picture;
|
||||
avctx->coded_frame->pict_type = FF_I_TYPE;
|
||||
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
avctx->coded_frame->key_frame = 1;
|
||||
|
||||
s->big_endian = 1;
|
||||
@ -136,7 +136,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
|
||||
switch(s->bits_per_component) {
|
||||
case 8:
|
||||
case 16:
|
||||
size = avpicture_layout((AVPicture*)data, avctx->pix_fmt,
|
||||
size = avpicture_layout(data, avctx->pix_fmt,
|
||||
avctx->width, avctx->height,
|
||||
buf + HEADER_SIZE, buf_size - HEADER_SIZE);
|
||||
if (size < 0)
|
||||
@ -146,7 +146,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
|
||||
size = avctx->height * avctx->width * 4;
|
||||
if (buf_size < HEADER_SIZE + size)
|
||||
return -1;
|
||||
encode_rgb48_10bit(avctx, (AVPicture*)data, buf + HEADER_SIZE);
|
||||
encode_rgb48_10bit(avctx, data, buf + HEADER_SIZE);
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n", s->bits_per_component);
|
||||
@ -160,13 +160,13 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
|
||||
}
|
||||
|
||||
AVCodec ff_dpx_encoder = {
|
||||
"dpx",
|
||||
AVMEDIA_TYPE_VIDEO,
|
||||
CODEC_ID_DPX,
|
||||
sizeof(DPXContext),
|
||||
encode_init,
|
||||
encode_frame,
|
||||
.pix_fmts= (const enum PixelFormat[]){
|
||||
.name = "dpx",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = CODEC_ID_DPX,
|
||||
.priv_data_size = sizeof(DPXContext),
|
||||
.init = encode_init,
|
||||
.encode = encode_frame,
|
||||
.pix_fmts = (const enum PixelFormat[]){
|
||||
PIX_FMT_RGB24,
|
||||
PIX_FMT_RGBA,
|
||||
PIX_FMT_RGB48LE,
|
||||
|
@ -94,6 +94,7 @@ static av_cold int cinvideo_decode_init(AVCodecContext *avctx)
|
||||
cin->avctx = avctx;
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
|
||||
avcodec_get_frame_defaults(&cin->frame);
|
||||
cin->frame.data[0] = NULL;
|
||||
|
||||
cin->bitmap_size = avctx->width * avctx->height;
|
||||
|
@ -43,15 +43,15 @@ uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0, };
|
||||
uint32_t ff_squareTbl[512] = {0, };
|
||||
|
||||
#define BIT_DEPTH 9
|
||||
#include "dsputil_internal.h"
|
||||
#include "dsputil_template.c"
|
||||
#undef BIT_DEPTH
|
||||
|
||||
#define BIT_DEPTH 10
|
||||
#include "dsputil_internal.h"
|
||||
#include "dsputil_template.c"
|
||||
#undef BIT_DEPTH
|
||||
|
||||
#define BIT_DEPTH 8
|
||||
#include "dsputil_internal.h"
|
||||
#include "dsputil_template.c"
|
||||
|
||||
// 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's native arithmetic size
|
||||
#define pb_7f (~0UL/255 * 0x7f)
|
||||
|
@ -27,7 +27,7 @@
|
||||
* DSP utils
|
||||
*/
|
||||
|
||||
#include "h264_high_depth.h"
|
||||
#include "high_bit_depth.h"
|
||||
|
||||
static inline void FUNC(copy_block2)(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
|
||||
{
|
||||
@ -886,7 +886,6 @@ H264_CHROMA_MC(avg_ , op_avg)
|
||||
#undef op_avg
|
||||
#undef op_put
|
||||
|
||||
#if 1
|
||||
#define H264_LOWPASS(OPNAME, OP, OP2) \
|
||||
static av_unused void FUNC(OPNAME ## h264_qpel2_h_lowpass)(uint8_t *p_dst, uint8_t *p_src, int dstStride, int srcStride){\
|
||||
const int h=2;\
|
||||
@ -1347,7 +1346,6 @@ H264_MC(avg_, 16)
|
||||
#undef op_put
|
||||
#undef op2_avg
|
||||
#undef op2_put
|
||||
#endif
|
||||
|
||||
#if BIT_DEPTH == 8
|
||||
# define put_h264_qpel8_mc00_8_c ff_put_pixels8x8_8_c
|
||||
@ -1391,3 +1389,4 @@ static void FUNCC(clear_blocks)(DCTELEM *blocks)
|
||||
{
|
||||
memset(blocks, 0, sizeof(dctcoef)*6*64);
|
||||
}
|
||||
|
@ -1093,9 +1093,10 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
|
||||
if (s->picture.data[0])
|
||||
avctx->release_buffer(avctx, &s->picture);
|
||||
|
||||
avcodec_get_frame_defaults(&s->picture);
|
||||
s->picture.reference = 0;
|
||||
s->picture.key_frame = 1;
|
||||
s->picture.pict_type = FF_I_TYPE;
|
||||
s->picture.pict_type = AV_PICTURE_TYPE_I;
|
||||
avctx->pix_fmt = s->sys->pix_fmt;
|
||||
avctx->time_base = s->sys->time_base;
|
||||
avcodec_set_dimensions(avctx, s->sys->width, s->sys->height);
|
||||
@ -1264,7 +1265,7 @@ static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size,
|
||||
c->pix_fmt = s->sys->pix_fmt;
|
||||
s->picture = *((AVFrame *)data);
|
||||
s->picture.key_frame = 1;
|
||||
s->picture.pict_type = FF_I_TYPE;
|
||||
s->picture.pict_type = AV_PICTURE_TYPE_I;
|
||||
|
||||
s->buf = buf;
|
||||
c->execute(c, dv_encode_video_segment, s->sys->work_chunks, NULL,
|
||||
|
@ -321,21 +321,10 @@ static void delete_region_display_list(DVBSubContext *ctx, DVBSubRegion *region)
|
||||
|
||||
}
|
||||
|
||||
static void delete_state(DVBSubContext *ctx)
|
||||
static void delete_cluts(DVBSubContext *ctx)
|
||||
{
|
||||
DVBSubRegion *region;
|
||||
DVBSubCLUT *clut;
|
||||
|
||||
while (ctx->region_list) {
|
||||
region = ctx->region_list;
|
||||
|
||||
ctx->region_list = region->next;
|
||||
|
||||
delete_region_display_list(ctx, region);
|
||||
av_free(region->pbuf);
|
||||
av_free(region);
|
||||
}
|
||||
|
||||
while (ctx->clut_list) {
|
||||
clut = ctx->clut_list;
|
||||
|
||||
@ -343,12 +332,35 @@ static void delete_state(DVBSubContext *ctx)
|
||||
|
||||
av_free(clut);
|
||||
}
|
||||
}
|
||||
|
||||
av_freep(&ctx->display_definition);
|
||||
static void delete_objects(DVBSubContext *ctx)
|
||||
{
|
||||
DVBSubObject *object;
|
||||
|
||||
/* Should already be null */
|
||||
if (ctx->object_list)
|
||||
av_log(0, AV_LOG_ERROR, "Memory deallocation error!\n");
|
||||
while (ctx->object_list) {
|
||||
object = ctx->object_list;
|
||||
|
||||
ctx->object_list = object->next;
|
||||
|
||||
av_free(object);
|
||||
}
|
||||
}
|
||||
|
||||
static void delete_regions(DVBSubContext *ctx)
|
||||
{
|
||||
DVBSubRegion *region;
|
||||
|
||||
while (ctx->region_list) {
|
||||
region = ctx->region_list;
|
||||
|
||||
ctx->region_list = region->next;
|
||||
|
||||
delete_region_display_list(ctx, region);
|
||||
|
||||
av_free(region->pbuf);
|
||||
av_free(region);
|
||||
}
|
||||
}
|
||||
|
||||
static av_cold int dvbsub_init_decoder(AVCodecContext *avctx)
|
||||
@ -433,7 +445,13 @@ static av_cold int dvbsub_close_decoder(AVCodecContext *avctx)
|
||||
DVBSubContext *ctx = avctx->priv_data;
|
||||
DVBSubRegionDisplay *display;
|
||||
|
||||
delete_state(ctx);
|
||||
delete_regions(ctx);
|
||||
|
||||
delete_objects(ctx);
|
||||
|
||||
delete_cluts(ctx);
|
||||
|
||||
av_freep(&ctx->display_definition);
|
||||
|
||||
while (ctx->display_list) {
|
||||
display = ctx->display_list;
|
||||
@ -1125,7 +1143,9 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx,
|
||||
av_dlog(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state);
|
||||
|
||||
if (page_state == 2) {
|
||||
delete_state(ctx);
|
||||
delete_regions(ctx);
|
||||
delete_objects(ctx);
|
||||
delete_cluts(ctx);
|
||||
}
|
||||
|
||||
tmp_display_list = ctx->display_list;
|
||||
|
@ -120,6 +120,14 @@ static void guess_palette(uint32_t *rgba_palette,
|
||||
uint8_t *alpha,
|
||||
uint32_t subtitle_color)
|
||||
{
|
||||
static const uint8_t level_map[4][4] = {
|
||||
// this configuration (full range, lowest to highest) in tests
|
||||
// seemed most common, so assume this
|
||||
{0xff},
|
||||
{0x00, 0xff},
|
||||
{0x00, 0x80, 0xff},
|
||||
{0x00, 0x55, 0xaa, 0xff},
|
||||
};
|
||||
uint8_t color_used[16];
|
||||
int nb_opaque_colors, i, level, j, r, g, b;
|
||||
|
||||
@ -138,18 +146,18 @@ static void guess_palette(uint32_t *rgba_palette,
|
||||
if (nb_opaque_colors == 0)
|
||||
return;
|
||||
|
||||
j = nb_opaque_colors;
|
||||
j = 0;
|
||||
memset(color_used, 0, 16);
|
||||
for(i = 0; i < 4; i++) {
|
||||
if (alpha[i] != 0) {
|
||||
if (!color_used[colormap[i]]) {
|
||||
level = (0xff * j) / nb_opaque_colors;
|
||||
level = level_map[nb_opaque_colors][j];
|
||||
r = (((subtitle_color >> 16) & 0xff) * level) >> 8;
|
||||
g = (((subtitle_color >> 8) & 0xff) * level) >> 8;
|
||||
b = (((subtitle_color >> 0) & 0xff) * level) >> 8;
|
||||
rgba_palette[i] = b | (g << 8) | (r << 16) | ((alpha[i] * 17) << 24);
|
||||
color_used[colormap[i]] = (i + 1);
|
||||
j--;
|
||||
j++;
|
||||
} else {
|
||||
rgba_palette[i] = (rgba_palette[color_used[colormap[i]] - 1] & 0x00ffffff) |
|
||||
((alpha[i] * 17) << 24);
|
||||
|
@ -240,13 +240,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
||||
switch(compr){
|
||||
case -1:
|
||||
c->pic.key_frame = 0;
|
||||
c->pic.pict_type = FF_P_TYPE;
|
||||
c->pic.pict_type = AV_PICTURE_TYPE_P;
|
||||
if(c->prev.data[0])
|
||||
memcpy(c->pic.data[0], c->prev.data[0], c->pic.linesize[0] * avctx->height);
|
||||
else{ // Should happen only when first frame is 'NULL'
|
||||
memset(c->pic.data[0], 0, c->pic.linesize[0] * avctx->height);
|
||||
c->pic.key_frame = 1;
|
||||
c->pic.pict_type = FF_I_TYPE;
|
||||
c->pic.pict_type = AV_PICTURE_TYPE_I;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -254,7 +254,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
||||
case 4:
|
||||
case 5:
|
||||
c->pic.key_frame = !(compr & 1);
|
||||
c->pic.pict_type = (compr & 1) ? FF_P_TYPE : FF_I_TYPE;
|
||||
c->pic.pict_type = (compr & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
|
||||
for(j = 0; j < avctx->height; j++){
|
||||
if(compr & 1){
|
||||
for(i = 0; i < avctx->width; i++)
|
||||
@ -269,7 +269,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
||||
case 12: // ScummVM coding
|
||||
case 13:
|
||||
c->pic.key_frame = 0;
|
||||
c->pic.pict_type = FF_P_TYPE;
|
||||
c->pic.pict_type = AV_PICTURE_TYPE_P;
|
||||
decode_13(avctx, c, c->pic.data[0], srcptr, c->prev.data[0]);
|
||||
break;
|
||||
default:
|
||||
@ -295,6 +295,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
c->avctx = avctx;
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
|
||||
avcodec_get_frame_defaults(&c->pic);
|
||||
avcodec_get_frame_defaults(&c->prev);
|
||||
|
||||
c->dsize = avctx->width * avctx->height * 2;
|
||||
if((c->decomp_buf = av_malloc(c->dsize)) == NULL) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
|
||||
|
@ -246,7 +246,7 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice,
|
||||
slice->slice_qs_delta = 0; /* XXX not implemented by FFmpeg */
|
||||
slice->slice_qp_delta = s->qscale - h->pps.init_qp;
|
||||
slice->redundant_pic_cnt = h->redundant_pic_count;
|
||||
if (h->slice_type == FF_B_TYPE)
|
||||
if (h->slice_type == AV_PICTURE_TYPE_B)
|
||||
slice->direct_spatial_mv_pred_flag = h->direct_spatial_mv_pred;
|
||||
slice->cabac_init_idc = h->pps.cabac ? h->cabac_init_idc : 0;
|
||||
if (h->deblocking_filter < 2)
|
||||
@ -403,7 +403,7 @@ static int decode_slice(AVCodecContext *avctx,
|
||||
position, size);
|
||||
ctx_pic->slice_count++;
|
||||
|
||||
if (h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE)
|
||||
if (h->slice_type != AV_PICTURE_TYPE_I && h->slice_type != AV_PICTURE_TYPE_SI)
|
||||
ctx_pic->pp.wBitFields &= ~(1 << 15); /* Set IntraPicFlag to 0 */
|
||||
return 0;
|
||||
}
|
||||
|
@ -44,11 +44,11 @@ static void fill_picture_parameters(AVCodecContext *avctx,
|
||||
memset(pp, 0, sizeof(*pp));
|
||||
pp->wDecodedPictureIndex = ff_dxva2_get_surface_index(ctx, current_picture);
|
||||
pp->wDeblockedPictureIndex = 0;
|
||||
if (s->pict_type != FF_I_TYPE)
|
||||
if (s->pict_type != AV_PICTURE_TYPE_I)
|
||||
pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->last_picture);
|
||||
else
|
||||
pp->wForwardRefPictureIndex = 0xffff;
|
||||
if (s->pict_type == FF_B_TYPE)
|
||||
if (s->pict_type == AV_PICTURE_TYPE_B)
|
||||
pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->next_picture);
|
||||
else
|
||||
pp->wBackwardRefPictureIndex = 0xffff;
|
||||
@ -61,8 +61,8 @@ static void fill_picture_parameters(AVCodecContext *avctx,
|
||||
pp->bBPPminus1 = 7;
|
||||
pp->bPicStructure = s->picture_structure;
|
||||
pp->bSecondField = is_field && !s->first_field;
|
||||
pp->bPicIntra = s->pict_type == FF_I_TYPE;
|
||||
pp->bPicBackwardPrediction = s->pict_type == FF_B_TYPE;
|
||||
pp->bPicIntra = s->pict_type == AV_PICTURE_TYPE_I;
|
||||
pp->bPicBackwardPrediction = s->pict_type == AV_PICTURE_TYPE_B;
|
||||
pp->bBidirectionalAveragingMode = 0;
|
||||
pp->bMVprecisionAndChromaRelation= 0; /* FIXME */
|
||||
pp->bChromaFormat = s->chroma_format;
|
||||
|
@ -42,11 +42,11 @@ static void fill_picture_parameters(AVCodecContext *avctx,
|
||||
memset(pp, 0, sizeof(*pp));
|
||||
pp->wDecodedPictureIndex =
|
||||
pp->wDeblockedPictureIndex = ff_dxva2_get_surface_index(ctx, current_picture);
|
||||
if (s->pict_type != FF_I_TYPE)
|
||||
if (s->pict_type != AV_PICTURE_TYPE_I)
|
||||
pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->last_picture);
|
||||
else
|
||||
pp->wForwardRefPictureIndex = 0xffff;
|
||||
if (s->pict_type == FF_B_TYPE)
|
||||
if (s->pict_type == AV_PICTURE_TYPE_B)
|
||||
pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->next_picture);
|
||||
else
|
||||
pp->wBackwardRefPictureIndex = 0xffff;
|
||||
@ -69,8 +69,8 @@ static void fill_picture_parameters(AVCodecContext *avctx,
|
||||
if (s->picture_structure & PICT_BOTTOM_FIELD)
|
||||
pp->bPicStructure |= 0x02;
|
||||
pp->bSecondField = v->interlace && v->fcm != 0x03 && !s->first_field;
|
||||
pp->bPicIntra = s->pict_type == FF_I_TYPE;
|
||||
pp->bPicBackwardPrediction = s->pict_type == FF_B_TYPE;
|
||||
pp->bPicIntra = s->pict_type == AV_PICTURE_TYPE_I;
|
||||
pp->bPicBackwardPrediction = s->pict_type == AV_PICTURE_TYPE_B;
|
||||
pp->bBidirectionalAveragingMode = (1 << 7) |
|
||||
((ctx->cfg->ConfigIntraResidUnsigned != 0) << 6) |
|
||||
((ctx->cfg->ConfigResidDiffAccelerator != 0) << 5) |
|
||||
@ -108,10 +108,10 @@ static void fill_picture_parameters(AVCodecContext *avctx,
|
||||
(v->interlace << 5) |
|
||||
(v->tfcntrflag << 4) |
|
||||
(v->finterpflag << 3) |
|
||||
((s->pict_type != FF_B_TYPE) << 2) |
|
||||
((s->pict_type != AV_PICTURE_TYPE_B) << 2) |
|
||||
(v->psf << 1) |
|
||||
(v->extended_dmv );
|
||||
if (s->pict_type != FF_I_TYPE)
|
||||
if (s->pict_type != AV_PICTURE_TYPE_I)
|
||||
pp->bPic4MVallowed = v->mv_mode == MV_PMODE_MIXED_MV ||
|
||||
(v->mv_mode == MV_PMODE_INTENSITY_COMP &&
|
||||
v->mv_mode2 == MV_PMODE_MIXED_MV);
|
||||
|
@ -43,6 +43,10 @@ typedef struct CmvContext {
|
||||
|
||||
static av_cold int cmv_decode_init(AVCodecContext *avctx){
|
||||
CmvContext *s = avctx->priv_data;
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
avcodec_get_frame_defaults(&s->last_frame);
|
||||
avcodec_get_frame_defaults(&s->last2_frame);
|
||||
|
||||
s->avctx = avctx;
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
return 0;
|
||||
@ -180,10 +184,10 @@ static int cmv_decode_frame(AVCodecContext *avctx,
|
||||
if ((buf[0]&1)) { // subtype
|
||||
cmv_decode_inter(s, buf+2, buf_end);
|
||||
s->frame.key_frame = 0;
|
||||
s->frame.pict_type = FF_P_TYPE;
|
||||
s->frame.pict_type = AV_PICTURE_TYPE_P;
|
||||
}else{
|
||||
s->frame.key_frame = 1;
|
||||
s->frame.pict_type = FF_I_TYPE;
|
||||
s->frame.pict_type = AV_PICTURE_TYPE_I;
|
||||
cmv_decode_intra(s, buf+2, buf_end);
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ static int tgq_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
if (!s->frame.data[0]) {
|
||||
s->frame.key_frame = 1;
|
||||
s->frame.pict_type = FF_I_TYPE;
|
||||
s->frame.pict_type = AV_PICTURE_TYPE_I;
|
||||
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
|
||||
if (avctx->get_buffer(avctx, &s->frame)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
|
@ -55,6 +55,8 @@ static av_cold int tgv_decode_init(AVCodecContext *avctx){
|
||||
s->avctx = avctx;
|
||||
avctx->time_base = (AVRational){1, 15};
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
avcodec_get_frame_defaults(&s->last_frame);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -300,7 +302,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
if(chunk_type==kVGT_TAG) {
|
||||
s->frame.key_frame = 1;
|
||||
s->frame.pict_type = FF_I_TYPE;
|
||||
s->frame.pict_type = AV_PICTURE_TYPE_I;
|
||||
if (unpack(buf, buf_end, s->frame.data[0], s->avctx->width, s->avctx->height)<0) {
|
||||
av_log(avctx, AV_LOG_WARNING, "truncated intra frame\n");
|
||||
return -1;
|
||||
@ -311,7 +313,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
|
||||
return buf_size;
|
||||
}
|
||||
s->frame.key_frame = 0;
|
||||
s->frame.pict_type = FF_P_TYPE;
|
||||
s->frame.pict_type = AV_PICTURE_TYPE_P;
|
||||
if (tgv_decode_inter(s, buf, buf_end)<0) {
|
||||
av_log(avctx, AV_LOG_WARNING, "truncated inter frame\n");
|
||||
return -1;
|
||||
|
@ -381,6 +381,14 @@ static void guess_mv(MpegEncContext *s){
|
||||
fixed[mb_xy]= f;
|
||||
if(f==MV_FROZEN)
|
||||
num_avail++;
|
||||
else if(s->last_picture.data[0] && s->last_picture.motion_val[0]){
|
||||
const int mb_y= mb_xy / s->mb_stride;
|
||||
const int mb_x= mb_xy % s->mb_stride;
|
||||
const int mot_index= (mb_x + mb_y*mot_stride) * mot_step;
|
||||
s->current_picture.motion_val[0][mot_index][0]= s->last_picture.motion_val[0][mot_index][0];
|
||||
s->current_picture.motion_val[0][mot_index][1]= s->last_picture.motion_val[0][mot_index][1];
|
||||
s->current_picture.ref_index[0][4*mb_xy] = s->last_picture.ref_index[0][4*mb_xy];
|
||||
}
|
||||
}
|
||||
|
||||
if((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) || num_avail <= mb_width/2){
|
||||
@ -639,7 +647,7 @@ static int is_intra_more_likely(MpegEncContext *s){
|
||||
if(undamaged_count < 5) return 0; //almost all MBs damaged -> use temporal prediction
|
||||
|
||||
//prevent dsp.sad() check, that requires access to the image
|
||||
if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration && s->pict_type == FF_I_TYPE)
|
||||
if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration && s->pict_type == AV_PICTURE_TYPE_I)
|
||||
return 1;
|
||||
|
||||
skip_amount= FFMAX(undamaged_count/50, 1); //check only upto 50 MBs
|
||||
@ -658,11 +666,12 @@ static int is_intra_more_likely(MpegEncContext *s){
|
||||
j++;
|
||||
if((j%skip_amount) != 0) continue; //skip a few to speed things up
|
||||
|
||||
if(s->pict_type==FF_I_TYPE){
|
||||
if(s->pict_type==AV_PICTURE_TYPE_I){
|
||||
uint8_t *mb_ptr = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
|
||||
uint8_t *last_mb_ptr= s->last_picture.data [0] + mb_x*16 + mb_y*16*s->linesize;
|
||||
|
||||
is_intra_likely += s->dsp.sad[0](NULL, last_mb_ptr, mb_ptr , s->linesize, 16);
|
||||
// FIXME need await_progress() here
|
||||
is_intra_likely -= s->dsp.sad[0](NULL, last_mb_ptr, last_mb_ptr+s->linesize*16, s->linesize, 16);
|
||||
}else{
|
||||
if(IS_INTRA(s->current_picture.mb_type[mb_xy]))
|
||||
@ -977,7 +986,7 @@ void ff_er_frame_end(MpegEncContext *s){
|
||||
}
|
||||
|
||||
/* guess MVs */
|
||||
if(s->pict_type==FF_B_TYPE){
|
||||
if(s->pict_type==AV_PICTURE_TYPE_B){
|
||||
for(mb_y=0; mb_y<s->mb_height; mb_y++){
|
||||
for(mb_x=0; mb_x<s->mb_width; mb_x++){
|
||||
int xy= mb_x*2 + mb_y*2*s->b8_stride;
|
||||
@ -1000,6 +1009,7 @@ void ff_er_frame_end(MpegEncContext *s){
|
||||
int time_pp= s->pp_time;
|
||||
int time_pb= s->pb_time;
|
||||
|
||||
// FIXME await_progress here
|
||||
s->mv[0][0][0] = s->next_picture.motion_val[0][xy][0]*time_pb/time_pp;
|
||||
s->mv[0][0][1] = s->next_picture.motion_val[0][xy][1]*time_pb/time_pp;
|
||||
s->mv[1][0][0] = s->next_picture.motion_val[0][xy][0]*(time_pb - time_pp)/time_pp;
|
||||
@ -1114,7 +1124,7 @@ ec_clean:
|
||||
const int mb_xy= s->mb_index2xy[i];
|
||||
int error= s->error_status_table[mb_xy];
|
||||
|
||||
if(s->pict_type!=FF_B_TYPE && (error&(DC_ERROR|MV_ERROR|AC_ERROR))){
|
||||
if(s->pict_type!=AV_PICTURE_TYPE_B && (error&(DC_ERROR|MV_ERROR|AC_ERROR))){
|
||||
s->mbskip_table[mb_xy]=0;
|
||||
}
|
||||
s->mbintra_table[mb_xy]=1;
|
||||
|
@ -61,6 +61,7 @@ static av_cold int escape124_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
Escape124Context *s = avctx->priv_data;
|
||||
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
avctx->pix_fmt = PIX_FMT_RGB555;
|
||||
|
||||
s->num_superblocks = ((unsigned)avctx->width / 8) *
|
||||
@ -214,7 +215,8 @@ static int escape124_decode_frame(AVCodecContext *avctx,
|
||||
uint16_t* old_frame_data, *new_frame_data;
|
||||
unsigned old_stride, new_stride;
|
||||
|
||||
AVFrame new_frame = { { 0 } };
|
||||
AVFrame new_frame;
|
||||
avcodec_get_frame_defaults(&new_frame);
|
||||
|
||||
init_get_bits(&gb, buf, buf_size * 8);
|
||||
|
||||
|
@ -250,8 +250,9 @@ typedef struct FFV1Context{
|
||||
uint8_t (*initial_states[MAX_QUANT_TABLES])[32];
|
||||
int run_index;
|
||||
int colorspace;
|
||||
int_fast16_t *sample_buffer;
|
||||
int16_t *sample_buffer;
|
||||
int gob_count;
|
||||
int packed_at_lsb;
|
||||
|
||||
int quant_table_count;
|
||||
|
||||
@ -279,7 +280,8 @@ static av_always_inline int fold(int diff, int bits){
|
||||
return diff;
|
||||
}
|
||||
|
||||
static inline int predict(int_fast16_t *src, int_fast16_t *last){
|
||||
static inline int predict(int16_t *src, int16_t *last)
|
||||
{
|
||||
const int LT= last[-1];
|
||||
const int T= last[ 0];
|
||||
const int L = src[-1];
|
||||
@ -287,7 +289,9 @@ static inline int predict(int_fast16_t *src, int_fast16_t *last){
|
||||
return mid_pred(L, L + T - LT, T);
|
||||
}
|
||||
|
||||
static inline int get_context(PlaneContext *p, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){
|
||||
static inline int get_context(PlaneContext *p, int16_t *src,
|
||||
int16_t *last, int16_t *last2)
|
||||
{
|
||||
const int LT= last[-1];
|
||||
const int T= last[ 0];
|
||||
const int RT= last[ 1];
|
||||
@ -506,7 +510,10 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state, int
|
||||
}
|
||||
|
||||
#if CONFIG_FFV1_ENCODER
|
||||
static av_always_inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){
|
||||
static av_always_inline int encode_line(FFV1Context *s, int w,
|
||||
int16_t *sample[2],
|
||||
int plane_index, int bits)
|
||||
{
|
||||
PlaneContext * const p= &s->plane[plane_index];
|
||||
RangeCoder * const c= &s->c;
|
||||
int x;
|
||||
@ -591,7 +598,7 @@ static av_always_inline int encode_line(FFV1Context *s, int w, int_fast16_t *sam
|
||||
static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){
|
||||
int x,y,i;
|
||||
const int ring_size= s->avctx->context_model ? 3 : 2;
|
||||
int_fast16_t *sample[3];
|
||||
int16_t *sample[3];
|
||||
s->run_index=0;
|
||||
|
||||
memset(s->sample_buffer, 0, ring_size*(w+6)*sizeof(*s->sample_buffer));
|
||||
@ -609,8 +616,14 @@ static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
|
||||
}
|
||||
encode_line(s, w, sample, plane_index, 8);
|
||||
}else{
|
||||
for(x=0; x<w; x++){
|
||||
sample[0][x]= ((uint16_t*)(src + stride*y))[x] >> (16 - s->avctx->bits_per_raw_sample);
|
||||
if(s->packed_at_lsb){
|
||||
for(x=0; x<w; x++){
|
||||
sample[0][x]= ((uint16_t*)(src + stride*y))[x];
|
||||
}
|
||||
}else{
|
||||
for(x=0; x<w; x++){
|
||||
sample[0][x]= ((uint16_t*)(src + stride*y))[x] >> (16 - s->avctx->bits_per_raw_sample);
|
||||
}
|
||||
}
|
||||
encode_line(s, w, sample, plane_index, s->avctx->bits_per_raw_sample);
|
||||
}
|
||||
@ -621,7 +634,7 @@ static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
|
||||
static void encode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
|
||||
int x, y, p, i;
|
||||
const int ring_size= s->avctx->context_model ? 3 : 2;
|
||||
int_fast16_t *sample[3][3];
|
||||
int16_t *sample[3][3];
|
||||
s->run_index=0;
|
||||
|
||||
memset(s->sample_buffer, 0, ring_size*3*(w+6)*sizeof(*s->sample_buffer));
|
||||
@ -725,6 +738,8 @@ static av_cold int common_init(AVCodecContext *avctx){
|
||||
s->avctx= avctx;
|
||||
s->flags= avctx->flags;
|
||||
|
||||
avcodec_get_frame_defaults(&s->picture);
|
||||
|
||||
dsputil_init(&s->dsp, avctx);
|
||||
|
||||
s->width = avctx->width;
|
||||
@ -964,6 +979,10 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
|
||||
avctx->coded_frame= &s->picture;
|
||||
switch(avctx->pix_fmt){
|
||||
case PIX_FMT_YUV420P9:
|
||||
case PIX_FMT_YUV420P10:
|
||||
case PIX_FMT_YUV422P10:
|
||||
s->packed_at_lsb = 1;
|
||||
case PIX_FMT_YUV444P16:
|
||||
case PIX_FMT_YUV422P16:
|
||||
case PIX_FMT_YUV420P16:
|
||||
@ -1160,7 +1179,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
|
||||
ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
|
||||
|
||||
*p = *pict;
|
||||
p->pict_type= FF_I_TYPE;
|
||||
p->pict_type= AV_PICTURE_TYPE_I;
|
||||
|
||||
if(avctx->gop_size==0 || f->picture_number % avctx->gop_size == 0){
|
||||
put_rac(c, &keystate, 1);
|
||||
@ -1305,7 +1324,10 @@ static av_cold int common_end(AVCodecContext *avctx){
|
||||
return 0;
|
||||
}
|
||||
|
||||
static av_always_inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){
|
||||
static av_always_inline void decode_line(FFV1Context *s, int w,
|
||||
int16_t *sample[2],
|
||||
int plane_index, int bits)
|
||||
{
|
||||
PlaneContext * const p= &s->plane[plane_index];
|
||||
RangeCoder * const c= &s->c;
|
||||
int x;
|
||||
@ -1365,7 +1387,7 @@ static av_always_inline void decode_line(FFV1Context *s, int w, int_fast16_t *sa
|
||||
|
||||
static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){
|
||||
int x, y;
|
||||
int_fast16_t *sample[2];
|
||||
int16_t *sample[2];
|
||||
sample[0]=s->sample_buffer +3;
|
||||
sample[1]=s->sample_buffer+w+6+3;
|
||||
|
||||
@ -1374,7 +1396,7 @@ static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
|
||||
memset(s->sample_buffer, 0, 2*(w+6)*sizeof(*s->sample_buffer));
|
||||
|
||||
for(y=0; y<h; y++){
|
||||
int_fast16_t *temp= sample[0]; //FIXME try a normal buffer
|
||||
int16_t *temp = sample[0]; //FIXME try a normal buffer
|
||||
|
||||
sample[0]= sample[1];
|
||||
sample[1]= temp;
|
||||
@ -1390,8 +1412,14 @@ static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
|
||||
}
|
||||
}else{
|
||||
decode_line(s, w, sample, plane_index, s->avctx->bits_per_raw_sample);
|
||||
for(x=0; x<w; x++){
|
||||
((uint16_t*)(src + stride*y))[x]= sample[1][x] << (16 - s->avctx->bits_per_raw_sample);
|
||||
if(s->packed_at_lsb){
|
||||
for(x=0; x<w; x++){
|
||||
((uint16_t*)(src + stride*y))[x]= sample[1][x];
|
||||
}
|
||||
}else{
|
||||
for(x=0; x<w; x++){
|
||||
((uint16_t*)(src + stride*y))[x]= sample[1][x] << (16 - s->avctx->bits_per_raw_sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
//STOP_TIMER("decode-line")}
|
||||
@ -1400,7 +1428,7 @@ static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
|
||||
|
||||
static void decode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
|
||||
int x, y, p;
|
||||
int_fast16_t *sample[3][2];
|
||||
int16_t *sample[3][2];
|
||||
for(x=0; x<3; x++){
|
||||
sample[x][0] = s->sample_buffer + x*2 *(w+6) + 3;
|
||||
sample[x][1] = s->sample_buffer + (x*2+1)*(w+6) + 3;
|
||||
@ -1412,7 +1440,7 @@ static void decode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int st
|
||||
|
||||
for(y=0; y<h; y++){
|
||||
for(p=0; p<3; p++){
|
||||
int_fast16_t *temp= sample[p][0]; //FIXME try a normal buffer
|
||||
int16_t *temp = sample[p][0]; //FIXME try a normal buffer
|
||||
|
||||
sample[p][0]= sample[p][1];
|
||||
sample[p][1]= temp;
|
||||
@ -1606,7 +1634,25 @@ static int read_header(FFV1Context *f){
|
||||
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
|
||||
return -1;
|
||||
}
|
||||
}else{
|
||||
}else if(f->avctx->bits_per_raw_sample==9) {
|
||||
switch(16*f->chroma_h_shift + f->chroma_v_shift){
|
||||
case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P16; break;
|
||||
case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P16; break;
|
||||
case 0x11: f->avctx->pix_fmt= PIX_FMT_YUV420P9 ; f->packed_at_lsb=1; break;
|
||||
default:
|
||||
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
|
||||
return -1;
|
||||
}
|
||||
}else if(f->avctx->bits_per_raw_sample==10) {
|
||||
switch(16*f->chroma_h_shift + f->chroma_v_shift){
|
||||
case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P16; break;
|
||||
case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P10; f->packed_at_lsb=1; break;
|
||||
case 0x11: f->avctx->pix_fmt= PIX_FMT_YUV420P10; f->packed_at_lsb=1; break;
|
||||
default:
|
||||
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
|
||||
return -1;
|
||||
}
|
||||
}else {
|
||||
switch(16*f->chroma_h_shift + f->chroma_v_shift){
|
||||
case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P16; break;
|
||||
case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P16; break;
|
||||
@ -1643,6 +1689,7 @@ static int read_header(FFV1Context *f){
|
||||
for(j=0; j<f->slice_count; j++){
|
||||
FFV1Context *fs= f->slice_context[j];
|
||||
fs->ac= f->ac;
|
||||
fs->packed_at_lsb= f->packed_at_lsb;
|
||||
|
||||
if(f->version >= 2){
|
||||
fs->slice_x = get_symbol(c, state, 0) *f->width ;
|
||||
@ -1723,7 +1770,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
||||
ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
|
||||
|
||||
|
||||
p->pict_type= FF_I_TYPE; //FIXME I vs. P
|
||||
p->pict_type= AV_PICTURE_TYPE_I; //FIXME I vs. P
|
||||
if(get_rac(c, &keystate)){
|
||||
p->key_frame= 1;
|
||||
if(read_header(f) < 0)
|
||||
@ -1810,7 +1857,7 @@ AVCodec ff_ffv1_encoder = {
|
||||
encode_frame,
|
||||
common_end,
|
||||
.capabilities = CODEC_CAP_SLICE_THREADS,
|
||||
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_NONE},
|
||||
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_YUV420P9, PIX_FMT_YUV420P10, PIX_FMT_YUV422P10, PIX_FMT_NONE},
|
||||
.long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
|
||||
};
|
||||
#endif
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "libavutil/crc.h"
|
||||
#include "libavutil/md5.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "avcodec.h"
|
||||
#include "get_bits.h"
|
||||
#include "golomb.h"
|
||||
@ -43,7 +44,7 @@
|
||||
typedef struct CompressionOptions {
|
||||
int compression_level;
|
||||
int block_time_ms;
|
||||
enum AVLPCType lpc_type;
|
||||
enum FFLPCType lpc_type;
|
||||
int lpc_passes;
|
||||
int lpc_coeff_precision;
|
||||
int min_prediction_order;
|
||||
@ -80,6 +81,7 @@ typedef struct FlacFrame {
|
||||
} FlacFrame;
|
||||
|
||||
typedef struct FlacEncodeContext {
|
||||
AVClass *class;
|
||||
PutBitContext pb;
|
||||
int channels;
|
||||
int samplerate;
|
||||
@ -156,16 +158,16 @@ static av_cold void dprint_compression_options(FlacEncodeContext *s)
|
||||
av_log(avctx, AV_LOG_DEBUG, " compression: %d\n", opt->compression_level);
|
||||
|
||||
switch (opt->lpc_type) {
|
||||
case AV_LPC_TYPE_NONE:
|
||||
case FF_LPC_TYPE_NONE:
|
||||
av_log(avctx, AV_LOG_DEBUG, " lpc type: None\n");
|
||||
break;
|
||||
case AV_LPC_TYPE_FIXED:
|
||||
case FF_LPC_TYPE_FIXED:
|
||||
av_log(avctx, AV_LOG_DEBUG, " lpc type: Fixed pre-defined coefficients\n");
|
||||
break;
|
||||
case AV_LPC_TYPE_LEVINSON:
|
||||
case FF_LPC_TYPE_LEVINSON:
|
||||
av_log(avctx, AV_LOG_DEBUG, " lpc type: Levinson-Durbin recursion with Welch window\n");
|
||||
break;
|
||||
case AV_LPC_TYPE_CHOLESKY:
|
||||
case FF_LPC_TYPE_CHOLESKY:
|
||||
av_log(avctx, AV_LOG_DEBUG, " lpc type: Cholesky factorization, %d pass%s\n",
|
||||
opt->lpc_passes, opt->lpc_passes == 1 ? "" : "es");
|
||||
break;
|
||||
@ -266,23 +268,32 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
||||
|
||||
s->options.block_time_ms = ((int[]){ 27, 27, 27,105,105,105,105,105,105,105,105,105,105})[level];
|
||||
|
||||
s->options.lpc_type = ((int[]){ AV_LPC_TYPE_FIXED, AV_LPC_TYPE_FIXED, AV_LPC_TYPE_FIXED,
|
||||
AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,
|
||||
AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,
|
||||
AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,
|
||||
AV_LPC_TYPE_LEVINSON})[level];
|
||||
if (s->options.lpc_type == FF_LPC_TYPE_DEFAULT)
|
||||
s->options.lpc_type = ((int[]){ FF_LPC_TYPE_FIXED, FF_LPC_TYPE_FIXED, FF_LPC_TYPE_FIXED,
|
||||
FF_LPC_TYPE_LEVINSON, FF_LPC_TYPE_LEVINSON, FF_LPC_TYPE_LEVINSON,
|
||||
FF_LPC_TYPE_LEVINSON, FF_LPC_TYPE_LEVINSON, FF_LPC_TYPE_LEVINSON,
|
||||
FF_LPC_TYPE_LEVINSON, FF_LPC_TYPE_LEVINSON, FF_LPC_TYPE_LEVINSON,
|
||||
FF_LPC_TYPE_LEVINSON})[level];
|
||||
|
||||
s->options.min_prediction_order = ((int[]){ 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})[level];
|
||||
s->options.max_prediction_order = ((int[]){ 3, 4, 4, 6, 8, 8, 8, 8, 12, 12, 12, 32, 32})[level];
|
||||
|
||||
s->options.prediction_order_method = ((int[]){ ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST,
|
||||
ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST,
|
||||
ORDER_METHOD_4LEVEL, ORDER_METHOD_LOG, ORDER_METHOD_4LEVEL,
|
||||
ORDER_METHOD_LOG, ORDER_METHOD_SEARCH, ORDER_METHOD_LOG,
|
||||
ORDER_METHOD_SEARCH})[level];
|
||||
if (s->options.prediction_order_method < 0)
|
||||
s->options.prediction_order_method = ((int[]){ ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST,
|
||||
ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST,
|
||||
ORDER_METHOD_4LEVEL, ORDER_METHOD_LOG, ORDER_METHOD_4LEVEL,
|
||||
ORDER_METHOD_LOG, ORDER_METHOD_SEARCH, ORDER_METHOD_LOG,
|
||||
ORDER_METHOD_SEARCH})[level];
|
||||
|
||||
s->options.min_partition_order = ((int[]){ 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})[level];
|
||||
s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level];
|
||||
if (s->options.min_partition_order > s->options.max_partition_order) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid partition orders: min=%d max=%d\n",
|
||||
s->options.min_partition_order, s->options.max_partition_order);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (s->options.min_partition_order < 0)
|
||||
s->options.min_partition_order = ((int[]){ 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})[level];
|
||||
if (s->options.max_partition_order < 0)
|
||||
s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level];
|
||||
|
||||
/* set compression option overrides from AVCodecContext */
|
||||
#if FF_API_USE_LPC
|
||||
@ -296,13 +307,14 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
||||
s->options.lpc_passes = avctx->use_lpc - 1;
|
||||
}
|
||||
#endif
|
||||
if (avctx->lpc_type > AV_LPC_TYPE_DEFAULT) {
|
||||
if (avctx->lpc_type > AV_LPC_TYPE_CHOLESKY) {
|
||||
#if FF_API_FLAC_GLOBAL_OPTS
|
||||
if (avctx->lpc_type > FF_LPC_TYPE_DEFAULT) {
|
||||
if (avctx->lpc_type > FF_LPC_TYPE_CHOLESKY) {
|
||||
av_log(avctx, AV_LOG_ERROR, "unknown lpc type: %d\n", avctx->lpc_type);
|
||||
return -1;
|
||||
}
|
||||
s->options.lpc_type = avctx->lpc_type;
|
||||
if (s->options.lpc_type == AV_LPC_TYPE_CHOLESKY) {
|
||||
if (s->options.lpc_type == FF_LPC_TYPE_CHOLESKY) {
|
||||
if (avctx->lpc_passes < 0) {
|
||||
// default number of passes for Cholesky
|
||||
s->options.lpc_passes = 2;
|
||||
@ -315,11 +327,12 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (s->options.lpc_type == AV_LPC_TYPE_NONE) {
|
||||
if (s->options.lpc_type == FF_LPC_TYPE_NONE) {
|
||||
s->options.min_prediction_order = 0;
|
||||
} else if (avctx->min_prediction_order >= 0) {
|
||||
if (s->options.lpc_type == AV_LPC_TYPE_FIXED) {
|
||||
if (s->options.lpc_type == FF_LPC_TYPE_FIXED) {
|
||||
if (avctx->min_prediction_order > MAX_FIXED_ORDER) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n",
|
||||
avctx->min_prediction_order);
|
||||
@ -333,10 +346,10 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
||||
}
|
||||
s->options.min_prediction_order = avctx->min_prediction_order;
|
||||
}
|
||||
if (s->options.lpc_type == AV_LPC_TYPE_NONE) {
|
||||
if (s->options.lpc_type == FF_LPC_TYPE_NONE) {
|
||||
s->options.max_prediction_order = 0;
|
||||
} else if (avctx->max_prediction_order >= 0) {
|
||||
if (s->options.lpc_type == AV_LPC_TYPE_FIXED) {
|
||||
if (s->options.lpc_type == FF_LPC_TYPE_FIXED) {
|
||||
if (avctx->max_prediction_order > MAX_FIXED_ORDER) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n",
|
||||
avctx->max_prediction_order);
|
||||
@ -356,6 +369,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if FF_API_FLAC_GLOBAL_OPTS
|
||||
if (avctx->prediction_order_method >= 0) {
|
||||
if (avctx->prediction_order_method > ORDER_METHOD_LOG) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid prediction order method: %d\n",
|
||||
@ -386,6 +400,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
||||
s->options.min_partition_order, s->options.max_partition_order);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (avctx->frame_size > 0) {
|
||||
if (avctx->frame_size < FLAC_MIN_BLOCKSIZE ||
|
||||
@ -399,6 +414,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
||||
}
|
||||
s->max_blocksize = s->avctx->frame_size;
|
||||
|
||||
#if FF_API_FLAC_GLOBAL_OPTS
|
||||
/* set LPC precision */
|
||||
if (avctx->lpc_coeff_precision > 0) {
|
||||
if (avctx->lpc_coeff_precision > MAX_LPC_PRECISION) {
|
||||
@ -407,10 +423,8 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
||||
return -1;
|
||||
}
|
||||
s->options.lpc_coeff_precision = avctx->lpc_coeff_precision;
|
||||
} else {
|
||||
/* default LPC precision */
|
||||
s->options.lpc_coeff_precision = 15;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* set maximum encoded frame size in verbatim mode */
|
||||
s->max_framesize = ff_flac_get_max_frame_size(s->avctx->frame_size,
|
||||
@ -459,7 +473,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size,
|
||||
s->options.max_prediction_order, AV_LPC_TYPE_LEVINSON);
|
||||
s->options.max_prediction_order, FF_LPC_TYPE_LEVINSON);
|
||||
|
||||
dprint_compression_options(s);
|
||||
|
||||
@ -900,8 +914,8 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
|
||||
|
||||
/* FIXED */
|
||||
sub->type = FLAC_SUBFRAME_FIXED;
|
||||
if (s->options.lpc_type == AV_LPC_TYPE_NONE ||
|
||||
s->options.lpc_type == AV_LPC_TYPE_FIXED || n <= max_order) {
|
||||
if (s->options.lpc_type == FF_LPC_TYPE_NONE ||
|
||||
s->options.lpc_type == FF_LPC_TYPE_FIXED || n <= max_order) {
|
||||
uint32_t bits[MAX_FIXED_ORDER+1];
|
||||
if (max_order > MAX_FIXED_ORDER)
|
||||
max_order = MAX_FIXED_ORDER;
|
||||
@ -1347,6 +1361,33 @@ static av_cold int flac_encode_close(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
|
||||
static const AVOption options[] = {
|
||||
{ "lpc_coeff_precision", "LPC coefficient precision", offsetof(FlacEncodeContext, options.lpc_coeff_precision), FF_OPT_TYPE_INT, {.dbl = 15 }, 0, MAX_LPC_PRECISION, FLAGS },
|
||||
{ "lpc_type", "LPC algorithm", offsetof(FlacEncodeContext, options.lpc_type), FF_OPT_TYPE_INT, {.dbl = FF_LPC_TYPE_DEFAULT }, FF_LPC_TYPE_DEFAULT, FF_LPC_TYPE_NB-1, FLAGS, "lpc_type" },
|
||||
{ "none", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_LPC_TYPE_NONE }, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
|
||||
{ "fixed", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_LPC_TYPE_FIXED }, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
|
||||
{ "levinson", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_LPC_TYPE_LEVINSON }, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
|
||||
{ "cholesky", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_LPC_TYPE_CHOLESKY }, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
|
||||
{ "lpc_passes", "Number of passes to use for Cholesky factorization during LPC analysis", offsetof(FlacEncodeContext, options.lpc_passes), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, FLAGS },
|
||||
{ "min_partition_order", NULL, offsetof(FlacEncodeContext, options.min_partition_order), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, MAX_PARTITION_ORDER, FLAGS },
|
||||
{ "max_partition_order", NULL, offsetof(FlacEncodeContext, options.max_partition_order), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, MAX_PARTITION_ORDER, FLAGS },
|
||||
{ "prediction_order_method", "Search method for selecting prediction order", offsetof(FlacEncodeContext, options.prediction_order_method), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, ORDER_METHOD_LOG, FLAGS, "predm" },
|
||||
{ "estimation", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_EST }, INT_MIN, INT_MAX, FLAGS, "predm" },
|
||||
{ "2level", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_2LEVEL }, INT_MIN, INT_MAX, FLAGS, "predm" },
|
||||
{ "4level", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_4LEVEL }, INT_MIN, INT_MAX, FLAGS, "predm" },
|
||||
{ "8level", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_8LEVEL }, INT_MIN, INT_MAX, FLAGS, "predm" },
|
||||
{ "search", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_SEARCH }, INT_MIN, INT_MAX, FLAGS, "predm" },
|
||||
{ "log", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_LOG }, INT_MIN, INT_MAX, FLAGS, "predm" },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
static const AVClass flac_encoder_class = {
|
||||
"FLAC encoder",
|
||||
av_default_item_name,
|
||||
options,
|
||||
LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
AVCodec ff_flac_encoder = {
|
||||
"flac",
|
||||
@ -1360,4 +1401,5 @@ AVCodec ff_flac_encoder = {
|
||||
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
|
||||
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||
.long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
|
||||
.priv_class = &flac_encoder_class,
|
||||
};
|
||||
|
@ -92,6 +92,7 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx)
|
||||
return 1;
|
||||
}
|
||||
avctx->pix_fmt = PIX_FMT_BGR24;
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
s->frame.data[0] = NULL;
|
||||
|
||||
return 0;
|
||||
@ -148,7 +149,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if ((avctx->width != s->image_width) || (avctx->height != s->image_height)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Frame width or height differs from first frames!\n");
|
||||
av_log(avctx, AV_LOG_ERROR, "fh = %d, fv %d vs ch = %d, cv = %d\n", avctx->height,
|
||||
avctx->width,s->image_height, s->image_width);
|
||||
avctx->width, s->image_height, s->image_width);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -195,7 +196,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
|
||||
s->zstream.next_in = buf + (get_bits_count(&gb) / 8);
|
||||
s->zstream.avail_in = size;
|
||||
s->zstream.next_out = s->tmpblock;
|
||||
s->zstream.avail_out = s->block_size*3;
|
||||
s->zstream.avail_out = s->block_size * 3;
|
||||
ret = inflate(&(s->zstream), Z_FINISH);
|
||||
if (ret == Z_DATA_ERROR) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\n");
|
||||
|
@ -260,12 +260,12 @@ static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf,
|
||||
|
||||
//mark the frame type so the muxer can mux it correctly
|
||||
if (I_frame) {
|
||||
p->pict_type = FF_I_TYPE;
|
||||
p->pict_type = AV_PICTURE_TYPE_I;
|
||||
p->key_frame = 1;
|
||||
s->last_key_frame = avctx->frame_number;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %d\n", avctx->frame_number);
|
||||
} else {
|
||||
p->pict_type = FF_P_TYPE;
|
||||
p->pict_type = AV_PICTURE_TYPE_P;
|
||||
p->key_frame = 0;
|
||||
}
|
||||
|
||||
|
@ -118,6 +118,7 @@ static av_cold int flic_decode_init(AVCodecContext *avctx)
|
||||
return -1;
|
||||
}
|
||||
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
s->frame.data[0] = NULL;
|
||||
s->new_palette = 0;
|
||||
|
||||
|
@ -88,10 +88,10 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
|
||||
s->pict_type = FF_I_TYPE + get_bits(&s->gb, 2);
|
||||
s->dropable= s->pict_type > FF_P_TYPE;
|
||||
s->pict_type = AV_PICTURE_TYPE_I + get_bits(&s->gb, 2);
|
||||
s->dropable= s->pict_type > AV_PICTURE_TYPE_P;
|
||||
if (s->dropable)
|
||||
s->pict_type = FF_P_TYPE;
|
||||
s->pict_type = AV_PICTURE_TYPE_P;
|
||||
|
||||
skip_bits1(&s->gb); /* deblocking flag */
|
||||
s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
|
||||
@ -109,7 +109,7 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
|
||||
|
||||
if(s->avctx->debug & FF_DEBUG_PICT_INFO){
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "%c esc_type:%d, qp:%d num:%d\n",
|
||||
s->dropable ? 'D' : av_get_pict_type_char(s->pict_type), s->h263_flv-1, s->qscale, s->picture_number);
|
||||
s->dropable ? 'D' : av_get_picture_type_char(s->pict_type), s->h263_flv-1, s->qscale, s->picture_number);
|
||||
}
|
||||
|
||||
s->y_dc_scale_table=
|
||||
|
@ -53,7 +53,7 @@ void ff_flv_encode_picture_header(MpegEncContext * s, int picture_number)
|
||||
put_bits(&s->pb, 16, s->width);
|
||||
put_bits(&s->pb, 16, s->height);
|
||||
}
|
||||
put_bits(&s->pb, 2, s->pict_type == FF_P_TYPE); /* PictureType */
|
||||
put_bits(&s->pb, 2, s->pict_type == AV_PICTURE_TYPE_P); /* PictureType */
|
||||
put_bits(&s->pb, 1, 1); /* DeblockingFlag: on */
|
||||
put_bits(&s->pb, 5, s->qscale); /* Quantizer */
|
||||
put_bits(&s->pb, 1, 0); /* ExtraInformation */
|
||||
|
@ -60,6 +60,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
FrapsContext * const s = avctx->priv_data;
|
||||
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
avctx->coded_frame = (AVFrame*)&s->frame;
|
||||
|
||||
s->avctx = avctx;
|
||||
@ -180,10 +181,10 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
return -1;
|
||||
}
|
||||
/* bit 31 means same as previous pic */
|
||||
f->pict_type = (header & (1U<<31))? FF_P_TYPE : FF_I_TYPE;
|
||||
f->key_frame = f->pict_type == FF_I_TYPE;
|
||||
f->pict_type = (header & (1U<<31))? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
|
||||
f->key_frame = f->pict_type == AV_PICTURE_TYPE_I;
|
||||
|
||||
if (f->pict_type == FF_I_TYPE) {
|
||||
if (f->pict_type == AV_PICTURE_TYPE_I) {
|
||||
buf32=(const uint32_t*)buf;
|
||||
for(y=0; y<avctx->height/2; y++){
|
||||
luma1=(uint32_t*)&f->data[0][ y*2*f->linesize[0] ];
|
||||
@ -223,10 +224,10 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
return -1;
|
||||
}
|
||||
/* bit 31 means same as previous pic */
|
||||
f->pict_type = (header & (1U<<31))? FF_P_TYPE : FF_I_TYPE;
|
||||
f->key_frame = f->pict_type == FF_I_TYPE;
|
||||
f->pict_type = (header & (1U<<31))? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
|
||||
f->key_frame = f->pict_type == AV_PICTURE_TYPE_I;
|
||||
|
||||
if (f->pict_type == FF_I_TYPE) {
|
||||
if (f->pict_type == AV_PICTURE_TYPE_I) {
|
||||
for(y=0; y<avctx->height; y++)
|
||||
memcpy(&f->data[0][ (avctx->height-y)*f->linesize[0] ],
|
||||
&buf[y*avctx->width*3],
|
||||
@ -252,11 +253,11 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
/* skip frame */
|
||||
if(buf_size == 8) {
|
||||
f->pict_type = FF_P_TYPE;
|
||||
f->pict_type = AV_PICTURE_TYPE_P;
|
||||
f->key_frame = 0;
|
||||
break;
|
||||
}
|
||||
f->pict_type = FF_I_TYPE;
|
||||
f->pict_type = AV_PICTURE_TYPE_I;
|
||||
f->key_frame = 1;
|
||||
if ((AV_RL32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n");
|
||||
@ -297,11 +298,11 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
/* skip frame */
|
||||
if(buf_size == 8) {
|
||||
f->pict_type = FF_P_TYPE;
|
||||
f->pict_type = AV_PICTURE_TYPE_P;
|
||||
f->key_frame = 0;
|
||||
break;
|
||||
}
|
||||
f->pict_type = FF_I_TYPE;
|
||||
f->pict_type = AV_PICTURE_TYPE_I;
|
||||
f->key_frame = 1;
|
||||
if ((AV_RL32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n");
|
||||
|
@ -27,7 +27,7 @@
|
||||
static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
if (avctx->width & 1) {
|
||||
av_log(avctx, AV_LOG_ERROR, "FRWU needs even width\n");
|
||||
av_log(avctx, AV_LOG_ERROR, "frwu needs even width\n");
|
||||
return -1;
|
||||
}
|
||||
avctx->pix_fmt = PIX_FMT_UYVY422;
|
||||
@ -61,7 +61,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||
if (avctx->get_buffer(avctx, pic) < 0)
|
||||
return -1;
|
||||
|
||||
pic->pict_type = FF_I_TYPE;
|
||||
pic->pict_type = AV_PICTURE_TYPE_I;
|
||||
pic->key_frame = 1;
|
||||
pic->interlaced_frame = 1;
|
||||
pic->top_field_first = 1;
|
||||
@ -110,7 +110,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
AVCodec ff_frwu_decoder = {
|
||||
"FRWU",
|
||||
"frwu",
|
||||
AVMEDIA_TYPE_VIDEO,
|
||||
CODEC_ID_FRWU,
|
||||
0,
|
||||
|
@ -127,7 +127,7 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
|
||||
|
||||
# define OPEN_READER(name, gb) \
|
||||
unsigned int name##_index = (gb)->index; \
|
||||
int name##_cache = 0
|
||||
av_unused unsigned int name##_cache
|
||||
|
||||
# define CLOSE_READER(name, gb) (gb)->index = name##_index
|
||||
|
||||
|
@ -150,7 +150,7 @@ static int gif_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int bu
|
||||
uint8_t *end = outbuf + buf_size;
|
||||
|
||||
*p = *pict;
|
||||
p->pict_type = FF_I_TYPE;
|
||||
p->pict_type = AV_PICTURE_TYPE_I;
|
||||
p->key_frame = 1;
|
||||
gif_image_write_header(avctx, &outbuf_ptr, (uint32_t *)pict->data[1]);
|
||||
gif_image_write_image(avctx, &outbuf_ptr, end, pict->data[0], pict->linesize[0]);
|
||||
|
@ -497,9 +497,9 @@ static int h261_decode_picture_header(H261Context *h){
|
||||
skip_bits(&s->gb, 8);
|
||||
}
|
||||
|
||||
// h261 has no I-FRAMES, but if we pass FF_I_TYPE for the first frame, the codec crashes if it does
|
||||
// h261 has no I-FRAMES, but if we pass AV_PICTURE_TYPE_I for the first frame, the codec crashes if it does
|
||||
// not contain all I-blocks (e.g. when a packet is lost)
|
||||
s->pict_type = FF_P_TYPE;
|
||||
s->pict_type = AV_PICTURE_TYPE_P;
|
||||
|
||||
h->gob_number = 0;
|
||||
return 0;
|
||||
@ -597,14 +597,14 @@ retry:
|
||||
|
||||
// for skipping the frame
|
||||
s->current_picture.pict_type= s->pict_type;
|
||||
s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
|
||||
s->current_picture.key_frame= s->pict_type == AV_PICTURE_TYPE_I;
|
||||
|
||||
#if FF_API_HURRY_UP
|
||||
/* skip everything if we are in a hurry>=5 */
|
||||
if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
|
||||
#endif
|
||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
|
||||
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
|
||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
||||
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||
return get_consumed_bytes(s, buf_size);
|
||||
|
||||
|
@ -148,7 +148,7 @@ void ff_h263_loop_filter(MpegEncContext * s){
|
||||
uint8_t *dest_cb= s->dest[1];
|
||||
uint8_t *dest_cr= s->dest[2];
|
||||
|
||||
// if(s->pict_type==FF_B_TYPE && !s->readable) return;
|
||||
// if(s->pict_type==AV_PICTURE_TYPE_B && !s->readable) return;
|
||||
|
||||
/*
|
||||
Diag Top
|
||||
|
@ -218,7 +218,7 @@ static int decode_slice(MpegEncContext *s){
|
||||
//printf("%d %d %06X\n", ret, get_bits_count(&s->gb), show_bits(&s->gb, 24));
|
||||
ret= s->decode_mb(s, s->block);
|
||||
|
||||
if (s->pict_type!=FF_B_TYPE)
|
||||
if (s->pict_type!=AV_PICTURE_TYPE_B)
|
||||
ff_h263_update_motion_val(s);
|
||||
|
||||
if(ret<0){
|
||||
@ -310,7 +310,7 @@ static int decode_slice(MpegEncContext *s){
|
||||
int max_extra=7;
|
||||
|
||||
/* no markers in M$ crap */
|
||||
if(s->msmpeg4_version && s->pict_type==FF_I_TYPE)
|
||||
if(s->msmpeg4_version && s->pict_type==AV_PICTURE_TYPE_I)
|
||||
max_extra+= 17;
|
||||
|
||||
/* buggy padding but the frame should still end approximately at the bitstream end */
|
||||
@ -600,16 +600,16 @@ retry:
|
||||
|
||||
// for skipping the frame
|
||||
s->current_picture.pict_type= s->pict_type;
|
||||
s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
|
||||
s->current_picture.key_frame= s->pict_type == AV_PICTURE_TYPE_I;
|
||||
|
||||
/* skip B-frames if we don't have reference frames */
|
||||
if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)) return get_consumed_bytes(s, buf_size);
|
||||
if(s->last_picture_ptr==NULL && (s->pict_type==AV_PICTURE_TYPE_B || s->dropable)) return get_consumed_bytes(s, buf_size);
|
||||
#if FF_API_HURRY_UP
|
||||
/* skip b frames if we are in a hurry */
|
||||
if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return get_consumed_bytes(s, buf_size);
|
||||
#endif
|
||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
|
||||
|| (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
|
||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
||||
|| (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||
return get_consumed_bytes(s, buf_size);
|
||||
#if FF_API_HURRY_UP
|
||||
@ -618,16 +618,16 @@ retry:
|
||||
#endif
|
||||
|
||||
if(s->next_p_frame_damaged){
|
||||
if(s->pict_type==FF_B_TYPE)
|
||||
if(s->pict_type==AV_PICTURE_TYPE_B)
|
||||
return get_consumed_bytes(s, buf_size);
|
||||
else
|
||||
s->next_p_frame_damaged=0;
|
||||
}
|
||||
|
||||
if((s->avctx->flags2 & CODEC_FLAG2_FAST) && s->pict_type==FF_B_TYPE){
|
||||
if((s->avctx->flags2 & CODEC_FLAG2_FAST) && s->pict_type==AV_PICTURE_TYPE_B){
|
||||
s->me.qpel_put= s->dsp.put_2tap_qpel_pixels_tab;
|
||||
s->me.qpel_avg= s->dsp.avg_2tap_qpel_pixels_tab;
|
||||
}else if((!s->no_rounding) || s->pict_type==FF_B_TYPE){
|
||||
}else if((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){
|
||||
s->me.qpel_put= s->dsp.put_qpel_pixels_tab;
|
||||
s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;
|
||||
}else{
|
||||
@ -680,7 +680,7 @@ retry:
|
||||
decode_slice(s);
|
||||
}
|
||||
|
||||
if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type==FF_I_TYPE)
|
||||
if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type==AV_PICTURE_TYPE_I)
|
||||
if(!CONFIG_MSMPEG4_DECODER || msmpeg4_decode_ext_header(s, buf_size) < 0){
|
||||
s->error_status_table[s->mb_num-1]= AC_ERROR|DC_ERROR|MV_ERROR;
|
||||
}
|
||||
@ -730,7 +730,7 @@ intrax8_decoded:
|
||||
|
||||
assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
|
||||
assert(s->current_picture.pict_type == s->pict_type);
|
||||
if (s->pict_type == FF_B_TYPE || s->low_delay) {
|
||||
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
|
||||
*pict= *(AVFrame*)s->current_picture_ptr;
|
||||
} else if (s->last_picture_ptr != NULL) {
|
||||
*pict= *(AVFrame*)s->last_picture_ptr;
|
||||
|
@ -45,11 +45,11 @@
|
||||
//#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
static const uint8_t rem6[QP_MAX_MAX+1]={
|
||||
static const uint8_t rem6[QP_MAX_NUM+1]={
|
||||
0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
|
||||
};
|
||||
|
||||
static const uint8_t div6[QP_MAX_MAX+1]={
|
||||
static const uint8_t div6[QP_MAX_NUM+1]={
|
||||
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,
|
||||
};
|
||||
|
||||
@ -586,6 +586,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx){
|
||||
|
||||
h->sps.bit_depth_luma = avctx->bits_per_raw_sample = 8;
|
||||
h->pixel_shift = 0;
|
||||
h->sps.bit_depth_luma = avctx->bits_per_raw_sample = 8;
|
||||
|
||||
h->thread_context[0] = h;
|
||||
h->outputed_poc = h->next_outputed_poc = INT_MIN;
|
||||
@ -733,6 +734,7 @@ static int decode_update_thread_context(AVCodecContext *dst, const AVCodecContex
|
||||
int ff_h264_frame_start(H264Context *h){
|
||||
MpegEncContext * const s = &h->s;
|
||||
int i;
|
||||
const int pixel_shift = h->pixel_shift;
|
||||
|
||||
if(MPV_frame_start(s, s->avctx) < 0)
|
||||
return -1;
|
||||
@ -749,14 +751,14 @@ int ff_h264_frame_start(H264Context *h){
|
||||
assert(s->linesize && s->uvlinesize);
|
||||
|
||||
for(i=0; i<16; i++){
|
||||
h->block_offset[i]= (4*((scan8[i] - scan8[0])&7)<<h->pixel_shift) + 4*s->linesize*((scan8[i] - scan8[0])>>3);
|
||||
h->block_offset[24+i]= (4*((scan8[i] - scan8[0])&7)<<h->pixel_shift) + 8*s->linesize*((scan8[i] - scan8[0])>>3);
|
||||
h->block_offset[i]= (4*((scan8[i] - scan8[0])&7) << pixel_shift) + 4*s->linesize*((scan8[i] - scan8[0])>>3);
|
||||
h->block_offset[24+i]= (4*((scan8[i] - scan8[0])&7) << pixel_shift) + 8*s->linesize*((scan8[i] - scan8[0])>>3);
|
||||
}
|
||||
for(i=0; i<4; i++){
|
||||
h->block_offset[16+i]=
|
||||
h->block_offset[20+i]= (4*((scan8[i] - scan8[0])&7)<<h->pixel_shift) + 4*s->uvlinesize*((scan8[i] - scan8[0])>>3);
|
||||
h->block_offset[20+i]= (4*((scan8[i] - scan8[0])&7) << pixel_shift) + 4*s->uvlinesize*((scan8[i] - scan8[0])>>3);
|
||||
h->block_offset[24+16+i]=
|
||||
h->block_offset[24+20+i]= (4*((scan8[i] - scan8[0])&7)<<h->pixel_shift) + 8*s->uvlinesize*((scan8[i] - scan8[0])>>3);
|
||||
h->block_offset[24+20+i]= (4*((scan8[i] - scan8[0])&7) << pixel_shift) + 8*s->uvlinesize*((scan8[i] - scan8[0])>>3);
|
||||
}
|
||||
|
||||
/* can't be in alloc_tables because linesize isn't known there.
|
||||
@ -918,7 +920,7 @@ static void decode_postinit(H264Context *h){
|
||||
else if((out_of_order && pics-1 == s->avctx->has_b_frames && s->avctx->has_b_frames < MAX_DELAYED_PIC_COUNT)
|
||||
|| (s->low_delay &&
|
||||
((h->next_outputed_poc != INT_MIN && out->poc > h->next_outputed_poc + 2)
|
||||
|| cur->pict_type == FF_B_TYPE)))
|
||||
|| cur->pict_type == AV_PICTURE_TYPE_B)))
|
||||
{
|
||||
s->low_delay = 0;
|
||||
s->avctx->has_b_frames++;
|
||||
@ -948,6 +950,7 @@ static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src
|
||||
MpegEncContext * const s = &h->s;
|
||||
uint8_t *top_border;
|
||||
int top_idx = 1;
|
||||
const int pixel_shift = h->pixel_shift;
|
||||
|
||||
src_y -= linesize;
|
||||
src_cb -= uvlinesize;
|
||||
@ -958,10 +961,10 @@ static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src
|
||||
if(!MB_MBAFF){
|
||||
top_border = h->top_borders[0][s->mb_x];
|
||||
AV_COPY128(top_border, src_y + 15*linesize);
|
||||
if (h->pixel_shift)
|
||||
if (pixel_shift)
|
||||
AV_COPY128(top_border+16, src_y+15*linesize+16);
|
||||
if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
|
||||
if (h->pixel_shift) {
|
||||
if (pixel_shift) {
|
||||
AV_COPY128(top_border+32, src_cb+7*uvlinesize);
|
||||
AV_COPY128(top_border+48, src_cr+7*uvlinesize);
|
||||
} else {
|
||||
@ -980,11 +983,11 @@ static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src
|
||||
// There are two lines saved, the line above the the top macroblock of a pair,
|
||||
// and the line above the bottom macroblock
|
||||
AV_COPY128(top_border, src_y + 16*linesize);
|
||||
if (h->pixel_shift)
|
||||
if (pixel_shift)
|
||||
AV_COPY128(top_border+16, src_y+16*linesize+16);
|
||||
|
||||
if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
|
||||
if (h->pixel_shift) {
|
||||
if (pixel_shift) {
|
||||
AV_COPY128(top_border+32, src_cb+8*uvlinesize);
|
||||
AV_COPY128(top_border+48, src_cr+8*uvlinesize);
|
||||
} else {
|
||||
@ -994,7 +997,10 @@ static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src
|
||||
}
|
||||
}
|
||||
|
||||
static inline void xchg_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int xchg, int simple, int pixel_shift){
|
||||
static inline void xchg_mb_border(H264Context *h, uint8_t *src_y,
|
||||
uint8_t *src_cb, uint8_t *src_cr,
|
||||
int linesize, int uvlinesize,
|
||||
int xchg, int simple, int pixel_shift){
|
||||
MpegEncContext * const s = &h->s;
|
||||
int deblock_left;
|
||||
int deblock_top;
|
||||
@ -1040,38 +1046,38 @@ else AV_COPY64(b,a);
|
||||
|
||||
if(deblock_top){
|
||||
if(deblock_left){
|
||||
XCHG(top_border_m1+(8<<pixel_shift), src_y -(7<<h->pixel_shift), 1);
|
||||
XCHG(top_border_m1 + (8 << pixel_shift), src_y - (7 << pixel_shift), 1);
|
||||
}
|
||||
XCHG(top_border+(0<<pixel_shift), src_y +(1<<pixel_shift), xchg);
|
||||
XCHG(top_border+(8<<pixel_shift), src_y +(9<<pixel_shift), 1);
|
||||
XCHG(top_border + (0 << pixel_shift), src_y + (1 << pixel_shift), xchg);
|
||||
XCHG(top_border + (8 << pixel_shift), src_y + (9 << pixel_shift), 1);
|
||||
if(s->mb_x+1 < s->mb_width){
|
||||
XCHG(h->top_borders[top_idx][s->mb_x+1], src_y +(17<<pixel_shift), 1);
|
||||
XCHG(h->top_borders[top_idx][s->mb_x+1], src_y + (17 << pixel_shift), 1);
|
||||
}
|
||||
}
|
||||
if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
|
||||
if(deblock_top){
|
||||
if(deblock_left){
|
||||
XCHG(top_border_m1+(16<<pixel_shift), src_cb -(7<<pixel_shift), 1);
|
||||
XCHG(top_border_m1+(24<<pixel_shift), src_cr -(7<<pixel_shift), 1);
|
||||
XCHG(top_border_m1 + (16 << pixel_shift), src_cb - (7 << pixel_shift), 1);
|
||||
XCHG(top_border_m1 + (24 << pixel_shift), src_cr - (7 << pixel_shift), 1);
|
||||
}
|
||||
XCHG(top_border+(16<<pixel_shift), src_cb+1+pixel_shift, 1);
|
||||
XCHG(top_border+(24<<pixel_shift), src_cr+1+pixel_shift, 1);
|
||||
XCHG(top_border + (16 << pixel_shift), src_cb+1+pixel_shift, 1);
|
||||
XCHG(top_border + (24 << pixel_shift), src_cr+1+pixel_shift, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static av_always_inline int dctcoef_get(H264Context *h, DCTELEM *mb, int index, int pixel_shift) {
|
||||
if (!pixel_shift)
|
||||
return mb[index];
|
||||
else
|
||||
return ((int32_t*)mb)[index];
|
||||
static av_always_inline int dctcoef_get(DCTELEM *mb, int high_bit_depth, int index) {
|
||||
if (high_bit_depth) {
|
||||
return AV_RN32A(((int32_t*)mb) + index);
|
||||
} else
|
||||
return AV_RN16A(mb + index);
|
||||
}
|
||||
|
||||
static av_always_inline void dctcoef_set(H264Context *h, DCTELEM *mb, int index, int value, int pixel_shift) {
|
||||
if (!pixel_shift)
|
||||
mb[index] = value;
|
||||
else
|
||||
((int32_t*)mb)[index] = value;
|
||||
static av_always_inline void dctcoef_set(DCTELEM *mb, int high_bit_depth, int index, int value) {
|
||||
if (high_bit_depth) {
|
||||
AV_WN32A(((int32_t*)mb) + index, value);
|
||||
} else
|
||||
AV_WN16A(mb + index, value);
|
||||
}
|
||||
|
||||
static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, int pixel_shift){
|
||||
@ -1090,12 +1096,12 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i
|
||||
void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride);
|
||||
void (*idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride);
|
||||
|
||||
dest_y = s->current_picture.data[0] + ((mb_x<<pixel_shift) + mb_y * s->linesize ) * 16;
|
||||
dest_cb = s->current_picture.data[1] + ((mb_x<<pixel_shift) + mb_y * s->uvlinesize) * 8;
|
||||
dest_cr = s->current_picture.data[2] + ((mb_x<<pixel_shift) + mb_y * s->uvlinesize) * 8;
|
||||
dest_y = s->current_picture.data[0] + ((mb_x << pixel_shift) + mb_y * s->linesize ) * 16;
|
||||
dest_cb = s->current_picture.data[1] + ((mb_x << pixel_shift) + mb_y * s->uvlinesize) * 8;
|
||||
dest_cr = s->current_picture.data[2] + ((mb_x << pixel_shift) + mb_y * s->uvlinesize) * 8;
|
||||
|
||||
s->dsp.prefetch(dest_y + (s->mb_x&3)*4*s->linesize + (64<<pixel_shift), s->linesize, 4);
|
||||
s->dsp.prefetch(dest_cb + (s->mb_x&7)*s->uvlinesize + (64<<pixel_shift), dest_cr - dest_cb, 2);
|
||||
s->dsp.prefetch(dest_y + (s->mb_x&3)*4*s->linesize + (64 << pixel_shift), s->linesize, 4);
|
||||
s->dsp.prefetch(dest_cb + (s->mb_x&7)*s->uvlinesize + (64 << pixel_shift), dest_cr - dest_cb, 2);
|
||||
|
||||
h->list_counts[mb_xy]= h->list_count;
|
||||
|
||||
@ -1186,16 +1192,16 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i
|
||||
uint8_t * const ptr= dest_y + block_offset[i];
|
||||
const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ];
|
||||
if(transform_bypass && h->sps.profile_idc==244 && dir<=1){
|
||||
h->hpc.pred8x8l_add[dir](ptr, h->mb + (i*16<<pixel_shift), linesize);
|
||||
h->hpc.pred8x8l_add[dir](ptr, h->mb + (i*16 << pixel_shift), linesize);
|
||||
}else{
|
||||
const int nnz = h->non_zero_count_cache[ scan8[i] ];
|
||||
h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
|
||||
(h->topright_samples_available<<i)&0x4000, linesize);
|
||||
if(nnz){
|
||||
if(nnz == 1 && dctcoef_get(h, h->mb, i*16, pixel_shift))
|
||||
idct_dc_add(ptr, h->mb + (i*16<<pixel_shift), linesize);
|
||||
if(nnz == 1 && dctcoef_get(h->mb, pixel_shift, i*16))
|
||||
idct_dc_add(ptr, h->mb + (i*16 << pixel_shift), linesize);
|
||||
else
|
||||
idct_add (ptr, h->mb + (i*16<<pixel_shift), linesize);
|
||||
idct_add (ptr, h->mb + (i*16 << pixel_shift), linesize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1212,7 +1218,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i
|
||||
const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ];
|
||||
|
||||
if(transform_bypass && h->sps.profile_idc==244 && dir<=1){
|
||||
h->hpc.pred4x4_add[dir](ptr, h->mb + (i*16<<pixel_shift), linesize);
|
||||
h->hpc.pred4x4_add[dir](ptr, h->mb + (i*16 << pixel_shift), linesize);
|
||||
}else{
|
||||
uint8_t *topright;
|
||||
int nnz, tr;
|
||||
@ -1229,7 +1235,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i
|
||||
topright= (uint8_t*) &tr;
|
||||
}
|
||||
}else
|
||||
topright= ptr + (4<<pixel_shift) - linesize;
|
||||
topright= ptr + (4 << pixel_shift) - linesize;
|
||||
}else
|
||||
topright= NULL;
|
||||
|
||||
@ -1237,8 +1243,8 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i
|
||||
nnz = h->non_zero_count_cache[ scan8[i] ];
|
||||
if(nnz){
|
||||
if(is_h264){
|
||||
if(nnz == 1 && dctcoef_get(h, h->mb, i*16, pixel_shift))
|
||||
idct_dc_add(ptr, h->mb + (i*16<<pixel_shift), linesize);
|
||||
if(nnz == 1 && dctcoef_get(h->mb, pixel_shift, i*16))
|
||||
idct_dc_add(ptr, h->mb + (i*16 << pixel_shift), linesize);
|
||||
else
|
||||
idct_add (ptr, h->mb + (i*16<<pixel_shift), linesize);
|
||||
}
|
||||
@ -1261,7 +1267,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i
|
||||
static const uint8_t dc_mapping[16] = { 0*16, 1*16, 4*16, 5*16, 2*16, 3*16, 6*16, 7*16,
|
||||
8*16, 9*16,12*16,13*16,10*16,11*16,14*16,15*16};
|
||||
for(i = 0; i < 16; i++)
|
||||
dctcoef_set(h, h->mb, dc_mapping[i], dctcoef_get(h, h->mb_luma_dc, i,pixel_shift),pixel_shift);
|
||||
dctcoef_set(h->mb, pixel_shift, dc_mapping[i], dctcoef_get(h->mb_luma_dc, pixel_shift, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1288,8 +1294,8 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i
|
||||
h->hpc.pred16x16_add[h->intra16x16_pred_mode](dest_y, block_offset, h->mb, linesize);
|
||||
}else{
|
||||
for(i=0; i<16; i++){
|
||||
if(h->non_zero_count_cache[ scan8[i] ] || dctcoef_get(h, h->mb, i*16,pixel_shift))
|
||||
s->dsp.add_pixels4(dest_y + block_offset[i], h->mb + (i*16<<pixel_shift), linesize);
|
||||
if(h->non_zero_count_cache[ scan8[i] ] || dctcoef_get(h->mb, pixel_shift, i*16))
|
||||
s->dsp.add_pixels4(dest_y + block_offset[i], h->mb + (i*16 << pixel_shift), linesize);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@ -1301,7 +1307,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i
|
||||
idct_add= IS_8x8DCT(mb_type) ? s->dsp.add_pixels8 : s->dsp.add_pixels4;
|
||||
for(i=0; i<16; i+=di){
|
||||
if(h->non_zero_count_cache[ scan8[i] ]){
|
||||
idct_add(dest_y + block_offset[i], h->mb + (i*16<<pixel_shift), linesize);
|
||||
idct_add(dest_y + block_offset[i], h->mb + (i*16 << pixel_shift), linesize);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@ -1329,21 +1335,21 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i
|
||||
uint8_t *dest[2] = {dest_cb, dest_cr};
|
||||
if(transform_bypass){
|
||||
if(IS_INTRA(mb_type) && h->sps.profile_idc==244 && (h->chroma_pred_mode==VERT_PRED8x8 || h->chroma_pred_mode==HOR_PRED8x8)){
|
||||
h->hpc.pred8x8_add[h->chroma_pred_mode](dest[0], block_offset + 16, h->mb + (16*16<<pixel_shift), uvlinesize);
|
||||
h->hpc.pred8x8_add[h->chroma_pred_mode](dest[1], block_offset + 20, h->mb + (20*16<<pixel_shift), uvlinesize);
|
||||
h->hpc.pred8x8_add[h->chroma_pred_mode](dest[0], block_offset + 16, h->mb + (16*16 << pixel_shift), uvlinesize);
|
||||
h->hpc.pred8x8_add[h->chroma_pred_mode](dest[1], block_offset + 20, h->mb + (20*16 << pixel_shift), uvlinesize);
|
||||
}else{
|
||||
idct_add = s->dsp.add_pixels4;
|
||||
for(i=16; i<16+8; i++){
|
||||
if(h->non_zero_count_cache[ scan8[i] ] || dctcoef_get(h, h->mb, i*16,pixel_shift))
|
||||
idct_add (dest[(i&4)>>2] + block_offset[i], h->mb + (i*16<<pixel_shift), uvlinesize);
|
||||
if(h->non_zero_count_cache[ scan8[i] ] || dctcoef_get(h->mb, pixel_shift, i*16))
|
||||
idct_add (dest[(i&4)>>2] + block_offset[i], h->mb + (i*16 << pixel_shift), uvlinesize);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(is_h264){
|
||||
if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+0] ])
|
||||
h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16*16<<pixel_shift) , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);
|
||||
h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16*16 << pixel_shift) , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);
|
||||
if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+1] ])
|
||||
h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + ((16*16+4*16)<<pixel_shift), h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);
|
||||
h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + ((16*16+4*16) << pixel_shift), h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);
|
||||
h->h264dsp.h264_idct_add8(dest, block_offset,
|
||||
h->mb, uvlinesize,
|
||||
h->non_zero_count_cache);
|
||||
@ -1370,9 +1376,12 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i
|
||||
/**
|
||||
* Process a macroblock; this case avoids checks for expensive uncommon cases.
|
||||
*/
|
||||
static void hl_decode_mb_simple8(H264Context *h){
|
||||
hl_decode_mb_internal(h, 1, 0);
|
||||
#define hl_decode_mb_simple(sh, bits) \
|
||||
static void hl_decode_mb_simple_ ## bits(H264Context *h){ \
|
||||
hl_decode_mb_internal(h, 1, sh); \
|
||||
}
|
||||
hl_decode_mb_simple(0, 8);
|
||||
hl_decode_mb_simple(1, 16);
|
||||
|
||||
/**
|
||||
* Process a macroblock; this handles edge cases, such as interlacing.
|
||||
@ -1387,11 +1396,12 @@ void ff_h264_hl_decode_mb(H264Context *h){
|
||||
const int mb_type= s->current_picture.mb_type[mb_xy];
|
||||
int is_complex = CONFIG_SMALL || h->is_complex || IS_INTRA_PCM(mb_type) || s->qscale == 0;
|
||||
|
||||
if (is_complex || h->pixel_shift)
|
||||
if (is_complex) {
|
||||
hl_decode_mb_complex(h);
|
||||
else{
|
||||
hl_decode_mb_simple8(h);
|
||||
}
|
||||
} else if (h->pixel_shift) {
|
||||
hl_decode_mb_simple_16(h);
|
||||
} else
|
||||
hl_decode_mb_simple_8(h);
|
||||
}
|
||||
|
||||
static int pred_weight_table(H264Context *h){
|
||||
@ -1449,7 +1459,7 @@ static int pred_weight_table(H264Context *h){
|
||||
}
|
||||
}
|
||||
}
|
||||
if(h->slice_type_nos != FF_B_TYPE) break;
|
||||
if(h->slice_type_nos != AV_PICTURE_TYPE_B) break;
|
||||
}
|
||||
h->use_weight= h->use_weight || h->use_weight_chroma;
|
||||
return 0;
|
||||
@ -1817,7 +1827,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
h->slice_type_fixed=0;
|
||||
|
||||
slice_type= golomb_to_pict_type[ slice_type ];
|
||||
if (slice_type == FF_I_TYPE
|
||||
if (slice_type == AV_PICTURE_TYPE_I
|
||||
|| (h0->current_slice != 0 && slice_type == h0->last_slice_type) ) {
|
||||
default_ref_list_done = 1;
|
||||
}
|
||||
@ -2110,15 +2120,15 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
h->ref_count[0]= h->pps.ref_count[0];
|
||||
h->ref_count[1]= h->pps.ref_count[1];
|
||||
|
||||
if(h->slice_type_nos != FF_I_TYPE){
|
||||
if(h->slice_type_nos == FF_B_TYPE){
|
||||
if(h->slice_type_nos != AV_PICTURE_TYPE_I){
|
||||
if(h->slice_type_nos == AV_PICTURE_TYPE_B){
|
||||
h->direct_spatial_mv_pred= get_bits1(&s->gb);
|
||||
}
|
||||
num_ref_idx_active_override_flag= get_bits1(&s->gb);
|
||||
|
||||
if(num_ref_idx_active_override_flag){
|
||||
h->ref_count[0]= get_ue_golomb(&s->gb) + 1;
|
||||
if(h->slice_type_nos==FF_B_TYPE)
|
||||
if(h->slice_type_nos==AV_PICTURE_TYPE_B)
|
||||
h->ref_count[1]= get_ue_golomb(&s->gb) + 1;
|
||||
|
||||
if(h->ref_count[0]-1 > 32-1 || h->ref_count[1]-1 > 32-1){
|
||||
@ -2127,7 +2137,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if(h->slice_type_nos == FF_B_TYPE)
|
||||
if(h->slice_type_nos == AV_PICTURE_TYPE_B)
|
||||
h->list_count= 2;
|
||||
else
|
||||
h->list_count= 1;
|
||||
@ -2138,22 +2148,22 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
ff_h264_fill_default_ref_list(h);
|
||||
}
|
||||
|
||||
if(h->slice_type_nos!=FF_I_TYPE && ff_h264_decode_ref_pic_list_reordering(h) < 0)
|
||||
if(h->slice_type_nos!=AV_PICTURE_TYPE_I && ff_h264_decode_ref_pic_list_reordering(h) < 0)
|
||||
return -1;
|
||||
|
||||
if(h->slice_type_nos!=FF_I_TYPE){
|
||||
if(h->slice_type_nos!=AV_PICTURE_TYPE_I){
|
||||
s->last_picture_ptr= &h->ref_list[0][0];
|
||||
ff_copy_picture(&s->last_picture, s->last_picture_ptr);
|
||||
}
|
||||
if(h->slice_type_nos==FF_B_TYPE){
|
||||
if(h->slice_type_nos==AV_PICTURE_TYPE_B){
|
||||
s->next_picture_ptr= &h->ref_list[1][0];
|
||||
ff_copy_picture(&s->next_picture, s->next_picture_ptr);
|
||||
}
|
||||
|
||||
if( (h->pps.weighted_pred && h->slice_type_nos == FF_P_TYPE )
|
||||
|| (h->pps.weighted_bipred_idc==1 && h->slice_type_nos== FF_B_TYPE ) )
|
||||
if( (h->pps.weighted_pred && h->slice_type_nos == AV_PICTURE_TYPE_P )
|
||||
|| (h->pps.weighted_bipred_idc==1 && h->slice_type_nos== AV_PICTURE_TYPE_B ) )
|
||||
pred_weight_table(h);
|
||||
else if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== FF_B_TYPE){
|
||||
else if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== AV_PICTURE_TYPE_B){
|
||||
implicit_weight_table(h, -1);
|
||||
}else {
|
||||
h->use_weight = 0;
|
||||
@ -2169,17 +2179,17 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
if(FRAME_MBAFF){
|
||||
ff_h264_fill_mbaff_ref_list(h);
|
||||
|
||||
if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== FF_B_TYPE){
|
||||
if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== AV_PICTURE_TYPE_B){
|
||||
implicit_weight_table(h, 0);
|
||||
implicit_weight_table(h, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if(h->slice_type_nos==FF_B_TYPE && !h->direct_spatial_mv_pred)
|
||||
if(h->slice_type_nos==AV_PICTURE_TYPE_B && !h->direct_spatial_mv_pred)
|
||||
ff_h264_direct_dist_scale_factor(h);
|
||||
ff_h264_direct_ref_list_init(h);
|
||||
|
||||
if( h->slice_type_nos != FF_I_TYPE && h->pps.cabac ){
|
||||
if( h->slice_type_nos != AV_PICTURE_TYPE_I && h->pps.cabac ){
|
||||
tmp = get_ue_golomb_31(&s->gb);
|
||||
if(tmp > 2){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "cabac_init_idc overflow\n");
|
||||
@ -2198,10 +2208,10 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale);
|
||||
h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale);
|
||||
//FIXME qscale / qp ... stuff
|
||||
if(h->slice_type == FF_SP_TYPE){
|
||||
if(h->slice_type == AV_PICTURE_TYPE_SP){
|
||||
get_bits1(&s->gb); /* sp_for_switch_flag */
|
||||
}
|
||||
if(h->slice_type==FF_SP_TYPE || h->slice_type == FF_SI_TYPE){
|
||||
if(h->slice_type==AV_PICTURE_TYPE_SP || h->slice_type == AV_PICTURE_TYPE_SI){
|
||||
get_se_golomb(&s->gb); /* slice_qs_delta */
|
||||
}
|
||||
|
||||
@ -2230,8 +2240,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
}
|
||||
|
||||
if( s->avctx->skip_loop_filter >= AVDISCARD_ALL
|
||||
||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type_nos != FF_I_TYPE)
|
||||
||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type_nos == FF_B_TYPE)
|
||||
||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type_nos != AV_PICTURE_TYPE_I)
|
||||
||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type_nos == AV_PICTURE_TYPE_B)
|
||||
||(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && h->nal_ref_idc == 0))
|
||||
h->deblocking_filter= 0;
|
||||
|
||||
@ -2307,7 +2317,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
h->slice_num,
|
||||
(s->picture_structure==PICT_FRAME ? "F" : s->picture_structure==PICT_TOP_FIELD ? "T" : "B"),
|
||||
first_mb_in_slice,
|
||||
av_get_pict_type_char(h->slice_type), h->slice_type_fixed ? " fix" : "", h->nal_unit_type == NAL_IDR_SLICE ? " IDR" : "",
|
||||
av_get_picture_type_char(h->slice_type), h->slice_type_fixed ? " fix" : "", h->nal_unit_type == NAL_IDR_SLICE ? " IDR" : "",
|
||||
pps_id, h->frame_num,
|
||||
s->current_picture_ptr->field_poc[0], s->current_picture_ptr->field_poc[1],
|
||||
h->ref_count[0], h->ref_count[1],
|
||||
@ -2315,7 +2325,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
h->deblocking_filter, h->slice_alpha_c0_offset/2-26, h->slice_beta_offset/2-26,
|
||||
h->use_weight,
|
||||
h->use_weight==1 && h->use_weight_chroma ? "c" : "",
|
||||
h->slice_type == FF_B_TYPE ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""
|
||||
h->slice_type == AV_PICTURE_TYPE_B ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""
|
||||
);
|
||||
}
|
||||
|
||||
@ -2325,11 +2335,11 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
int ff_h264_get_slice_type(const H264Context *h)
|
||||
{
|
||||
switch (h->slice_type) {
|
||||
case FF_P_TYPE: return 0;
|
||||
case FF_B_TYPE: return 1;
|
||||
case FF_I_TYPE: return 2;
|
||||
case FF_SP_TYPE: return 3;
|
||||
case FF_SI_TYPE: return 4;
|
||||
case AV_PICTURE_TYPE_P: return 0;
|
||||
case AV_PICTURE_TYPE_B: return 1;
|
||||
case AV_PICTURE_TYPE_I: return 2;
|
||||
case AV_PICTURE_TYPE_SP: return 3;
|
||||
case AV_PICTURE_TYPE_SI: return 4;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
@ -2557,6 +2567,7 @@ static void loop_filter(H264Context *h){
|
||||
const int end_mb_y= s->mb_y + FRAME_MBAFF;
|
||||
const int old_slice_type= h->slice_type;
|
||||
const int end_mb_x = s->mb_x;
|
||||
const int pixel_shift = h->pixel_shift;
|
||||
|
||||
if(h->deblocking_filter) {
|
||||
int start_x= s->resync_mb_y == s->mb_y ? s->resync_mb_x : 0;
|
||||
@ -2573,9 +2584,9 @@ static void loop_filter(H264Context *h){
|
||||
|
||||
s->mb_x= mb_x;
|
||||
s->mb_y= mb_y;
|
||||
dest_y = s->current_picture.data[0] + ((mb_x<<h->pixel_shift) + mb_y * s->linesize ) * 16;
|
||||
dest_cb = s->current_picture.data[1] + ((mb_x<<h->pixel_shift) + mb_y * s->uvlinesize) * 8;
|
||||
dest_cr = s->current_picture.data[2] + ((mb_x<<h->pixel_shift) + mb_y * s->uvlinesize) * 8;
|
||||
dest_y = s->current_picture.data[0] + ((mb_x << pixel_shift) + mb_y * s->linesize ) * 16;
|
||||
dest_cb = s->current_picture.data[1] + ((mb_x << pixel_shift) + mb_y * s->uvlinesize) * 8;
|
||||
dest_cr = s->current_picture.data[2] + ((mb_x << pixel_shift) + mb_y * s->uvlinesize) * 8;
|
||||
//FIXME simplify above
|
||||
|
||||
if (MB_FIELD) {
|
||||
@ -2952,7 +2963,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
|
||||
bit_length= !dst_length ? 0 : (8*dst_length - ff_h264_decode_rbsp_trailing(h, ptr + dst_length - 1));
|
||||
|
||||
if(s->avctx->debug&FF_DEBUG_STARTCODE){
|
||||
av_log(h->s.avctx, AV_LOG_DEBUG, "NAL %d at %d/%d length %d\n", hx->nal_unit_type, buf_index, buf_size, dst_length);
|
||||
av_log(h->s.avctx, AV_LOG_DEBUG, "NAL %d/%d at %d/%d length %d\n", hx->nal_unit_type, hx->nal_ref_idc, buf_index, buf_size, dst_length);
|
||||
}
|
||||
|
||||
if (h->is_avc && (nalsize != consumed) && nalsize){
|
||||
@ -3007,8 +3018,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
|
||||
&& hx->s.hurry_up < 5
|
||||
#endif
|
||||
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
|
||||
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE)
|
||||
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
|
||||
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
|
||||
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I)
|
||||
&& avctx->skip_frame < AVDISCARD_ALL){
|
||||
if(avctx->hwaccel) {
|
||||
if (avctx->hwaccel->decode_slice(avctx, &buf[buf_index - consumed], consumed) < 0)
|
||||
@ -3047,8 +3058,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
|
||||
&& s->hurry_up < 5
|
||||
#endif
|
||||
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
|
||||
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE)
|
||||
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
|
||||
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
|
||||
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I)
|
||||
&& avctx->skip_frame < AVDISCARD_ALL)
|
||||
context_count++;
|
||||
break;
|
||||
@ -3060,7 +3071,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
|
||||
init_get_bits(&s->gb, ptr, bit_length);
|
||||
ff_h264_decode_seq_parameter_set(h);
|
||||
|
||||
if(s->flags& CODEC_FLAG_LOW_DELAY)
|
||||
if(s->flags& CODEC_FLAG_LOW_DELAY ||
|
||||
(h->sps.bitstream_restriction_flag && !h->sps.num_reorder_frames))
|
||||
s->low_delay=1;
|
||||
|
||||
if(avctx->has_b_frames < 2)
|
||||
@ -3069,7 +3081,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
|
||||
if (avctx->bits_per_raw_sample != h->sps.bit_depth_luma) {
|
||||
if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10) {
|
||||
avctx->bits_per_raw_sample = h->sps.bit_depth_luma;
|
||||
h->pixel_shift = h->sps.bit_depth_luma/9;
|
||||
h->pixel_shift = h->sps.bit_depth_luma > 8;
|
||||
|
||||
ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma);
|
||||
ff_h264_pred_init(&h->hpc, s->codec_id, h->sps.bit_depth_luma);
|
||||
|
@ -108,7 +108,7 @@
|
||||
*/
|
||||
#define DELAYED_PIC_REF 4
|
||||
|
||||
#define QP_MAX_MAX (51 + 2*6) // The maximum supported qp
|
||||
#define QP_MAX_NUM (51 + 2*6) // The maximum supported qp
|
||||
|
||||
/* NAL unit types */
|
||||
enum {
|
||||
@ -266,7 +266,7 @@ typedef struct MMCO{
|
||||
typedef struct H264Context{
|
||||
MpegEncContext s;
|
||||
H264DSPContext h264dsp;
|
||||
int pixel_shift;
|
||||
int pixel_shift; ///< 0 for 8-bit H264, 1 for high-bit-depth H264
|
||||
int chroma_qp[2]; //QPc
|
||||
|
||||
int qp_thresh; ///< QP threshold to skip loopfilter
|
||||
@ -355,8 +355,8 @@ typedef struct H264Context{
|
||||
*/
|
||||
PPS pps; //FIXME move to Picture perhaps? (->no) do we need that?
|
||||
|
||||
uint32_t dequant4_buffer[6][QP_MAX_MAX+1][16]; //FIXME should these be moved down?
|
||||
uint32_t dequant8_buffer[2][QP_MAX_MAX+1][64];
|
||||
uint32_t dequant4_buffer[6][QP_MAX_NUM+1][16]; //FIXME should these be moved down?
|
||||
uint32_t dequant8_buffer[2][QP_MAX_NUM+1][64];
|
||||
uint32_t (*dequant4_coeff[6])[16];
|
||||
uint32_t (*dequant8_coeff[2])[64];
|
||||
|
||||
@ -594,17 +594,10 @@ typedef struct H264Context{
|
||||
// Timestamp stuff
|
||||
int sei_buffering_period_present; ///< Buffering period SEI flag
|
||||
int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
|
||||
|
||||
//SVQ3 specific fields
|
||||
int halfpel_flag;
|
||||
int thirdpel_flag;
|
||||
int unknown_svq3_flag;
|
||||
int next_slice_index;
|
||||
uint32_t svq3_watermark_key;
|
||||
}H264Context;
|
||||
|
||||
|
||||
extern const uint8_t ff_h264_chroma_qp[3][QP_MAX_MAX+1]; ///< One chroma qp table for each supported bit depth (8, 9, 10).
|
||||
extern const uint8_t ff_h264_chroma_qp[3][QP_MAX_NUM+1]; ///< One chroma qp table for each supported bit depth (8, 9, 10).
|
||||
|
||||
/**
|
||||
* Decode SEI
|
||||
@ -1118,7 +1111,7 @@ static void fill_decode_caches(H264Context *h, int mb_type){
|
||||
}
|
||||
AV_ZERO16(h->mvd_cache [list][scan8[4 ]]);
|
||||
AV_ZERO16(h->mvd_cache [list][scan8[12]]);
|
||||
if(h->slice_type_nos == FF_B_TYPE){
|
||||
if(h->slice_type_nos == AV_PICTURE_TYPE_B){
|
||||
fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, MB_TYPE_16x16>>1, 1);
|
||||
|
||||
if(IS_DIRECT(top_type)){
|
||||
@ -1255,7 +1248,7 @@ static inline void write_back_motion(H264Context *h, int mb_type){
|
||||
}
|
||||
}
|
||||
|
||||
if(h->slice_type_nos == FF_B_TYPE && CABAC){
|
||||
if(h->slice_type_nos == AV_PICTURE_TYPE_B && CABAC){
|
||||
if(IS_8X8(mb_type)){
|
||||
uint8_t *direct_table = &h->direct_table[4*h->mb_xy];
|
||||
direct_table[1] = h->sub_mb_type[1]>>1;
|
||||
@ -1286,7 +1279,7 @@ static void av_unused decode_mb_skip(H264Context *h){
|
||||
if(MB_FIELD)
|
||||
mb_type|= MB_TYPE_INTERLACED;
|
||||
|
||||
if( h->slice_type_nos == FF_B_TYPE )
|
||||
if( h->slice_type_nos == AV_PICTURE_TYPE_B )
|
||||
{
|
||||
// just for fill_caches. pred_direct_motion will set the real mb_type
|
||||
mb_type|= MB_TYPE_L0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user