Compare commits
159 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a97ba5215 | |||
| 2ad23b93b5 | |||
| cec38382db | |||
| 0ff1825ea3 | |||
| 4423cbf1b4 | |||
| c4153d40d5 | |||
| cc0d2f110d | |||
| 86296fe24d | |||
| 342f1da134 | |||
| 5e67a2e13a | |||
| 9efd80dc09 | |||
| ce7f65be6e | |||
| 9b97afe7ad | |||
| af54886de8 | |||
| e5bbb52194 | |||
| d7d5a3379d | |||
| 64f0fd5998 | |||
| dd93df46a6 | |||
| c1c50fc4a7 | |||
| d06972535e | |||
| 93437a18d8 | |||
| d07f78ae72 | |||
| cd478122b0 | |||
| 6723a43609 | |||
| 2980b95faf | |||
| 11498c22a0 | |||
| 2fdb27b512 | |||
| c1b74d608c | |||
| edf200e2bc | |||
| 6ed5e44998 | |||
| aed915b8a6 | |||
| 540f4467c8 | |||
| bae4d39437 | |||
| f56215d3ff | |||
| 56b0179b6a | |||
| e755482d36 | |||
| facd0521e4 | |||
| 7b56d6584c | |||
| 092febb2ad | |||
| 04949cc08e | |||
| ece7879992 | |||
| 4715ef27a0 | |||
| 8263246ba8 | |||
| 097bc4d32d | |||
| a3add19240 | |||
| 5365904e96 | |||
| 62024c1277 | |||
| b1af55778b | |||
| 6abe1e06f5 | |||
| 91f5a2b7b8 | |||
| 7e402c31ef | |||
| fb9560b366 | |||
| 0e7d8ce37c | |||
| e55a6c5f05 | |||
| 0288d15cdd | |||
| 43c03866b2 | |||
| 2e426fae43 | |||
| d147e2d55d | |||
| d6a13f031c | |||
| 0f0a2ff5a0 | |||
| a3832486e4 | |||
| 9aa0ed850b | |||
| 93c8720b91 | |||
| d36714f727 | |||
| a7c60c5b7b | |||
| fbb27e2911 | |||
| ad85d9af13 | |||
| 4a53ecb12e | |||
| 7c3d519df9 | |||
| d8104977bb | |||
| 650cb712ef | |||
| 31d6f3df25 | |||
| bc839fb39d | |||
| 1fab842fbb | |||
| 60d250386b | |||
| c5fd23879a | |||
| d8d1689f92 | |||
| c741095eec | |||
| b2169c8bcc | |||
| 3a6140e4cf | |||
| a749f4864e | |||
| c147aefc3e | |||
| 23319f7764 | |||
| 36db62ca98 | |||
| 17f05ff656 | |||
| 0ccbbf034d | |||
| f7357facd8 | |||
| ed87667bd3 | |||
| 983d119c9b | |||
| e56f691283 | |||
| 3ae71b648a | |||
| f2f0273588 | |||
| de20dad15e | |||
| 1549890035 | |||
| 35c7a1df8a | |||
| f8fcb6bbf0 | |||
| 50c93ce5ef | |||
| 9a00ce0ff8 | |||
| 8aabc4fdb5 | |||
| 2e58db3db0 | |||
| 4942de6f93 | |||
| cc9d1bb839 | |||
| 0ba93614cf | |||
| ecf2755a41 | |||
| 23d5f15b42 | |||
| 77cfc820cf | |||
| 53715eb13e | |||
| 7b16eacf81 | |||
| d25736dc87 | |||
| 6ccf19198b | |||
| 44fb120112 | |||
| db82e4f1e0 | |||
| 168ee58255 | |||
| 3a143bfa19 | |||
| ed87b8b61f | |||
| 87f39642f3 | |||
| 8ec1ff14fe | |||
| 3f2be02b4d | |||
| 56ce961cc3 | |||
| 3ca4f1868d | |||
| 0ee2cb866c | |||
| 78b8aeee58 | |||
| 66e65e0a68 | |||
| 6be60aedcb | |||
| dccead84c6 | |||
| b3bdb0ddc1 | |||
| 7a23220bf9 | |||
| 1c931d5ab9 | |||
| 7ff156b112 | |||
| 561e276899 | |||
| bcfbcbec48 | |||
| 2940b3e17c | |||
| 8d51090dcb | |||
| 5ab992cd38 | |||
| ceed79323c | |||
| 752659ff1e | |||
| 67c0793835 | |||
| 62e99f026a | |||
| e3c09fb986 | |||
| fac3cfb6c1 | |||
| 9ccb6de56c | |||
| 6ad4d3c92f | |||
| d55794fafc | |||
| 88a6fca74d | |||
| 46aa734646 | |||
| 0158fd5276 | |||
| 0ca0ec26a6 | |||
| a94cb36ab2 | |||
| 587fadaef1 | |||
| 01e291a592 | |||
| 03351cce88 | |||
| 46abeb1c32 | |||
| 35e36046f1 | |||
| 8500de89ea | |||
| a11a18b284 | |||
| 7deb7e6acd | |||
| 7fb85ad360 | |||
| c8642473e0 | |||
| b1ec41a64f |
@@ -1,7 +1,145 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
version 3.4.2:
|
||||
- avcodec/vp3: Error out on invalid num_coeffs in unpack_vlcs()
|
||||
- avcodec/mpeg4videodec: Ignore multiple VOL headers
|
||||
- avcodec/vp3: Check eob_run
|
||||
- avcodec/pafvideo: Check allocated frame size
|
||||
- avcodec/scpr: Fix reading a pixel before the first
|
||||
- avcodec/mpeg2dec: Fix field selection for skipped macroblocks
|
||||
- avcodec/huffyuvdec: Check input buffer size
|
||||
- avcodec/utvideodec: Fix bytes left check in decode_frame()
|
||||
- avcodec/wavpack: Fix integer overflow in FFABS
|
||||
- avcodec/aacsbr_fixed: Fix overflows in rounding in sbr_hf_assemble()
|
||||
- avcodec/exr: Fix memleaks in decode_header()
|
||||
- avcodec/mediacodecdec: use ff_hevc_ps_uninit()
|
||||
- avcodec/hevc_parser: use ff_hevc_uninit_parameter_sets()
|
||||
- avcodec/hevcdec: use ff_hevc_uninit_parameter_sets()
|
||||
- avcodec/hevc_ps: add a function to uninitialize parameter set buffers
|
||||
- avcodec/dirac_dwt: Fix several integer overflows
|
||||
- avcodec/indeo5: Do not leave frame_type set to an invalid value
|
||||
- avcodec/hevc_ps: Check log2_sao_offset_scale_*
|
||||
- avcodec/mpeg4videodec: Avoid possibly aliasing violating casts
|
||||
- avcodec/get_bits: Document the return code of get_vlc2()
|
||||
- avcodec/mpeg4videodec: Check mb_num also against 0
|
||||
- avfilter/vf_transpose: Fix used plane count.
|
||||
- avcodec/hevc_cabac: Check prefix so as to avoid invalid shifts in coeff_abs_level_remaining_decode()
|
||||
- avcodec/mjpegdec: Fix integer overflow in DC dequantization
|
||||
- avcodec/dxtory: Fix bits left checks
|
||||
- avcodec/hevc_cabac: Move prefix check in coeff_abs_level_remaining_decode() down
|
||||
- avcodec/truemotion2: Fix integer overflow in TM2_RECALC_BLOCK()
|
||||
- avcodec/snowdec: Fix integer overflow before htaps check
|
||||
- avcodec/ulti: Check number of blocks at init
|
||||
- avcodec/wavpack: Fix integer overflows in wv_unpack_stereo / mono
|
||||
- avcodec/jpeg2000: Check sum of sizes of band->prec before allocating
|
||||
- avcodec/ac3dec_fixed: Fix integer overflow in scale_coefs()
|
||||
- avformat/lrcdec: Fix memory leak in lrc_read_header()
|
||||
- avformat/matroskadec: Fix float-cast-overflow undefined behavior in matroska_parse_tracks()
|
||||
- lavfi/deinterlace_vaapi: fix can't show full option information.
|
||||
- configure:version 3.4.1: bump year
|
||||
- avcodec/utils: Avoid hardcoding duplicated types in sizeof()
|
||||
- avcodec/arm/sbrdsp_neon: Use a free register instead of putting 2 things in one
|
||||
- avcodec/h264addpx_template: Fixes integer overflows
|
||||
- avcodec/dirac_dwt: Fix overflows in COMPOSE_HAARiH0/COMPOSE_HAARiL0
|
||||
- avcodec/diracdec: Fix integer overflow with quant
|
||||
- avcodec/opus_parser: Check payload_len in parse_opus_ts_header()
|
||||
- avcodec/jpeg2000dsp: Fix integer overflows in ict_int()
|
||||
- avcodec/h264_slice: Do not attempt to render into frames already output
|
||||
- avcodec/dnxhddec: Check dc vlc
|
||||
- avcodec/exr: Check buf_size more completely
|
||||
- avcodec/flacdec: Fix overflow in multiplication in decode_subframe_fixed()
|
||||
- avcodec/hevcdsp_template: Fix Invalid shifts in put_hevc_qpel_bi_w_h() and put_hevc_qpel_bi_w_w()
|
||||
- avcodec/flacdec: avoid undefined shift
|
||||
- avcodec/hevcdsp_template.c: Fix undefined shift in FUNC(dequant)
|
||||
- avcodec/dirac_dwt: Fix integer overflow in COMPOSE_DD97iH0() and COMPOSE_DD137iL0()
|
||||
- avcodec/hevc_cabac: Fix integer overflow in ff_hevc_cu_qp_delta_abs()
|
||||
- tests/audiomatch: Add missing return code at the end of main()
|
||||
- avcodec/hevc_sei: Fix integer overflows in decode_nal_sei_message()
|
||||
- avcodec/hevcdsp_template: Fix undefined shift in put_hevc_qpel_bi_w_hv()
|
||||
- avcodec/h264_parse: Treat escaped and unescaped decoding error equal in decode_extradata_ps_mp4()
|
||||
- avcodec/vp9: mark frame as finished on decode_tiles() failure
|
||||
- libavfilter/af_dcshift.c: Fixed repeated spelling error
|
||||
- avfilter/formats: fix wrong function name in error message
|
||||
|
||||
version 3.4.1:
|
||||
- avcodec/vp9_superframe_split_bsf: Fix integer overflow in frame_size/total_size checks
|
||||
- avcodec/amrwbdec: Fix division by 0 in voice_factor()
|
||||
- avformat/utils: Fix warning: ISO C90 forbids mixed declarations and code
|
||||
- avcodec/decode: reset codec on receiving packet after EOF in compat_decode
|
||||
- avcodec/diracdsp: Fix integer overflow in PUT_SIGNED_RECT_CLAMPED()
|
||||
- avcodec/dirac_dwt: Fix integer overflows in COMPOSE_DAUB97*
|
||||
- avcodec/extract_extradata_bsf: Fix leak discovered via fuzzing
|
||||
- avcodec/vorbis: Fix another 1 << 31 > int32_t::max() with 1u.
|
||||
- avcodec/vorbis: 1 << 31 > int32_t::max(), so use 1u << 31 instead.
|
||||
- avformat/utils: Prevent undefined shift with wrap_bits > 64.
|
||||
- avcodec/j2kenc: Fix out of array access in encode_cblk()
|
||||
- avcodec/hevcdsp_template: Fix undefined shift in put_hevc_epel_bi_w_h()
|
||||
- lavf/mov: fix huge alloc in mov_read_ctts
|
||||
- avcodec/mlpdsp: Fix signed integer overflow, 2nd try
|
||||
- avcodec/h264idct_template: Fix integer overflow in ff_h264_idct8_add
|
||||
- avcodec/kgv1dec: Check that there is enough input for maximum RLE compression
|
||||
- avformat/aacdec: Fix leak in adts_aac_read_packet()
|
||||
- avcodec/dirac_dwt: Fix integer overflow in COMPOSE_FIDELITYi*
|
||||
- avcodec/sbrdsp_fixed: Fix integer overflow
|
||||
- avcodec/mpeg4videodec: Check also for negative versions in the validity check
|
||||
- Close ogg stream upon error when using AV_EF_EXPLODE.
|
||||
- Fix undefined shift on assumed 8-bit input.
|
||||
- Use ff_thread_once for fixed, float table init.
|
||||
- Fix leak of frame_duration_buffer in mov_fix_index().
|
||||
- avformat/mov: Propagate errors in mov_switch_root.
|
||||
- avcodec/hevcdsp_template: Fix invalid shift in put_hevc_epel_bi_w_v()
|
||||
- avcodec/mlpdsp: Fix undefined shift ff_mlp_pack_output()
|
||||
- avcodec/zmbv: Check that the buffer is large enough for mvec
|
||||
- avcodec/dirac_dwt: Fix integer overflow in COMPOSE_DD137iL0()
|
||||
- avcodec/wmv2dec: Check end of bitstream in parse_mb_skip() and ff_wmv2_decode_mb()
|
||||
- avcodec/snowdec: Check for remaining bitstream in decode_blocks()
|
||||
- avcodec/snowdec: Check intra block dc differences.
|
||||
- avformat/mov: Check size of STSC allocation
|
||||
- avcodec/vc2enc: Clear coef_buf on allocation
|
||||
- avcodec/h264dec: Fix potential array overread
|
||||
- avcodec/x86/mpegvideodsp: Fix signedness bug in need_emu
|
||||
- avcodec/aacpsdsp_template: Fix integer overflows in ps_decorrelate_c()
|
||||
- avcodec/aacdec_fixed: Fix undefined shift
|
||||
- avcodec/mdct_*: Fix integer overflow in addition in RESCALE()
|
||||
- avcodec/snowdec: Fix integer overflow in header parsing
|
||||
- avcodec/cngdec: Fix integer clipping
|
||||
- avcodec/sbrdsp_fixed: Fix integer overflow in shift in sbr_hf_g_filt_c()
|
||||
- avcodec/aacsbr_fixed: Fix division by zero in sbr_gain_calc()
|
||||
- avutil/softfloat: Add FLOAT_MIN
|
||||
- avcodec/h264idct_template: Fix integer overflows in ff_h264_idct8_add()
|
||||
- avcodec/xan: Check for bitstream end in xan_huffman_decode()
|
||||
- avcodec/exr: fix undefined shift in pxr24_uncompress()
|
||||
- avformat: Free the internal codec context at the end
|
||||
- avcodec/h264idct_template: Fix integer overflows in ff_h264_idct8_add()
|
||||
- avcodec/xan: Improve overlapping check
|
||||
- avcodec/aacdec_fixed: Fix integer overflow in apply_dependent_coupling_fixed()
|
||||
- avcodec/aacdec_fixed: Fix integer overflow in predict()
|
||||
- avcodec/jpeglsdec: Check for end of bitstream in ls_decode_line()
|
||||
- avcodec/jpeglsdec: Check ilv for being a supported value
|
||||
- tests/ffserver.regression.ref: update checksums to what ffserver currently produces
|
||||
- ffserver: Fix off by 1 error in path
|
||||
- avcodec/proresdec: align dequantization matrix buffers
|
||||
- avformat/matroskaenc: add missing allocation failure checks for stream durations
|
||||
- avformat/matroskaenc: actually enforce the stream limit
|
||||
- configure: Fix dependencies of aac_at decoder.
|
||||
- Don't manipulate duration when it's AV_NOPTS_VALUE.
|
||||
- lavfi/af_pan: fix sign handling in channel coefficient parser
|
||||
- avformat/hlsenc: write fmp4 init header after first AV frame
|
||||
- avformat/hlsenc: allocate space for terminating null
|
||||
- avformat/hlsenc: reindent hlsenc code
|
||||
- avformat/hlsenc: check hls segment mode for ignore the init filename
|
||||
- avformat/hlsenc: reindent hlsenc code
|
||||
- avformat/hlsenc: fix missing first segment bug in fmp4 mode
|
||||
- avformat/hlsenc: fix base_output_dirname is null when basename_size is 0 bug
|
||||
- ffplay: use SDL2 audio API
|
||||
- ffplay: only use hardware accelerated SDL texture formats
|
||||
- ffplay: create the window and the renderer before starting playback
|
||||
- ffmpeg: always init output stream before reaping filters
|
||||
- vc2enc_dwt: pad the temporary buffer by the slice size
|
||||
- lavu/arm: Check for have_vfp_vm instead of !have_vfpv3 for float_dsp_vfp
|
||||
|
||||
version 3.4:
|
||||
- deflicker video filter
|
||||
- doubleweave video filter
|
||||
- lumakey video filter
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
┌───────────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 3.4 "Cantor" │
|
||||
└───────────────────────────────────────┘
|
||||
|
||||
The FFmpeg Project proudly presents FFmpeg 3.4 "Cantor", about 6
|
||||
months after the release of FFmpeg 3.3.
|
||||
|
||||
A complete Changelog is available at the root of the project, and the
|
||||
complete Git history on http://source.ffmpeg.org.
|
||||
|
||||
We hope you will like this release as much as we enjoyed working on it, and
|
||||
as usual, if you have any questions about it, or any FFmpeg related topic,
|
||||
feel free to join us on the #ffmpeg IRC channel (on irc.freenode.net) or ask
|
||||
on the mailing-lists.
|
||||
@@ -2903,6 +2903,7 @@ mjpeg2jpeg_bsf_select="jpegtables"
|
||||
|
||||
# external libraries
|
||||
aac_at_decoder_deps="audiotoolbox"
|
||||
aac_at_decoder_select="aac_adtstoasc_bsf"
|
||||
ac3_at_decoder_deps="audiotoolbox"
|
||||
ac3_at_decoder_select="ac3_parser"
|
||||
adpcm_ima_qt_at_decoder_deps="audiotoolbox"
|
||||
@@ -3089,9 +3090,9 @@ decklink_indev_deps="decklink threads"
|
||||
decklink_indev_extralibs="-lstdc++"
|
||||
decklink_outdev_deps="decklink threads"
|
||||
decklink_outdev_extralibs="-lstdc++"
|
||||
libndi_newtek_indev_deps="libndi_newtek libdl"
|
||||
libndi_newtek_indev_deps="libndi_newtek"
|
||||
libndi_newtek_indev_extralibs="-lndi"
|
||||
libndi_newtek_outdev_deps="libndi_newtek libdl"
|
||||
libndi_newtek_outdev_deps="libndi_newtek"
|
||||
libndi_newtek_outdev_extralibs="-lndi"
|
||||
dshow_indev_deps="IBaseFilter"
|
||||
dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi"
|
||||
@@ -6309,9 +6310,14 @@ fi
|
||||
|
||||
check_disable_warning(){
|
||||
warning_flag=-W${1#-Wno-}
|
||||
test_cflags $warning_flag && add_cflags $1
|
||||
test_cflags $unknown_warning_flags $warning_flag && add_cflags $1
|
||||
}
|
||||
|
||||
test_cflags -Werror=unused-command-line-argument &&
|
||||
append unknown_warning_flags "-Werror=unused-command-line-argument"
|
||||
test_cflags -Werror=unknown-warning-option &&
|
||||
append unknown_warning_flags "-Werror=unknown-warning-option"
|
||||
|
||||
check_disable_warning -Wno-parentheses
|
||||
check_disable_warning -Wno-switch
|
||||
check_disable_warning -Wno-format-zero-length
|
||||
@@ -6994,7 +7000,7 @@ cat > $TMPH <<EOF
|
||||
#define FFMPEG_CONFIG_H
|
||||
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
|
||||
#define FFMPEG_LICENSE "$(c_escape $license)"
|
||||
#define CONFIG_THIS_YEAR 2017
|
||||
#define CONFIG_THIS_YEAR 2018
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_NUMBER = 3.4.2
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
+16
-2
@@ -2665,8 +2665,13 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
|
||||
ist->next_dts = AV_NOPTS_VALUE;
|
||||
}
|
||||
|
||||
if (got_output)
|
||||
ist->next_pts += av_rescale_q(duration_pts, ist->st->time_base, AV_TIME_BASE_Q);
|
||||
if (got_output) {
|
||||
if (duration_pts > 0) {
|
||||
ist->next_pts += av_rescale_q(duration_pts, ist->st->time_base, AV_TIME_BASE_Q);
|
||||
} else {
|
||||
ist->next_pts += duration_dts;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AVMEDIA_TYPE_SUBTITLE:
|
||||
if (repeating)
|
||||
@@ -4531,6 +4536,15 @@ static int transcode_step(void)
|
||||
}
|
||||
|
||||
if (ost->filter && ost->filter->graph->graph) {
|
||||
if (!ost->initialized) {
|
||||
char error[1024] = {0};
|
||||
ret = init_output_stream(ost, error, sizeof(error));
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error initializing output stream %d:%d -- %s\n",
|
||||
ost->file_index, ost->index, error);
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
if ((ret = transcode_from_filter(ost->filter->graph, &ist)) < 0)
|
||||
return ret;
|
||||
if (!ist)
|
||||
|
||||
+51
-39
@@ -361,6 +361,8 @@ static AVPacket flush_pkt;
|
||||
|
||||
static SDL_Window *window;
|
||||
static SDL_Renderer *renderer;
|
||||
static SDL_RendererInfo renderer_info = {0};
|
||||
static SDL_AudioDeviceID audio_dev;
|
||||
|
||||
static const struct TextureFormatEntry {
|
||||
enum AVPixelFormat format;
|
||||
@@ -1191,7 +1193,7 @@ static void stream_component_close(VideoState *is, int stream_index)
|
||||
switch (codecpar->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
decoder_abort(&is->auddec, &is->sampq);
|
||||
SDL_CloseAudio();
|
||||
SDL_CloseAudioDevice(audio_dev);
|
||||
decoder_destroy(&is->auddec);
|
||||
swr_free(&is->swr_ctx);
|
||||
av_freep(&is->audio_buf1);
|
||||
@@ -1320,38 +1322,15 @@ static int video_open(VideoState *is)
|
||||
h = default_height;
|
||||
}
|
||||
|
||||
if (!window) {
|
||||
int flags = SDL_WINDOW_SHOWN;
|
||||
if (!window_title)
|
||||
window_title = input_filename;
|
||||
if (is_full_screen)
|
||||
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
if (borderless)
|
||||
flags |= SDL_WINDOW_BORDERLESS;
|
||||
else
|
||||
flags |= SDL_WINDOW_RESIZABLE;
|
||||
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, flags);
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
||||
if (window) {
|
||||
SDL_RendererInfo info;
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||
if (!renderer) {
|
||||
av_log(NULL, AV_LOG_WARNING, "Failed to initialize a hardware accelerated renderer: %s\n", SDL_GetError());
|
||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||
}
|
||||
if (renderer) {
|
||||
if (!SDL_GetRendererInfo(renderer, &info))
|
||||
av_log(NULL, AV_LOG_VERBOSE, "Initialized %s renderer.\n", info.name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SDL_SetWindowSize(window, w, h);
|
||||
}
|
||||
if (!window_title)
|
||||
window_title = input_filename;
|
||||
SDL_SetWindowTitle(window, window_title);
|
||||
|
||||
if (!window || !renderer) {
|
||||
av_log(NULL, AV_LOG_FATAL, "SDL: could not set video mode - exiting\n");
|
||||
do_exit(is);
|
||||
}
|
||||
SDL_SetWindowSize(window, w, h);
|
||||
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
||||
if (is_full_screen)
|
||||
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
SDL_ShowWindow(window);
|
||||
|
||||
is->width = w;
|
||||
is->height = h;
|
||||
@@ -1362,7 +1341,7 @@ static int video_open(VideoState *is)
|
||||
/* display the current picture, if any */
|
||||
static void video_display(VideoState *is)
|
||||
{
|
||||
if (!window)
|
||||
if (!is->width)
|
||||
video_open(is);
|
||||
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
@@ -1850,10 +1829,18 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
||||
AVCodecParameters *codecpar = is->video_st->codecpar;
|
||||
AVRational fr = av_guess_frame_rate(is->ic, is->video_st, NULL);
|
||||
AVDictionaryEntry *e = NULL;
|
||||
int i;
|
||||
int nb_pix_fmts = 0;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(pix_fmts); i++)
|
||||
pix_fmts[i] = sdl_texture_format_map[i].format;
|
||||
for (i = 0; i < renderer_info.num_texture_formats; i++) {
|
||||
for (j = 0; j < FF_ARRAY_ELEMS(sdl_texture_format_map) - 1; j++) {
|
||||
if (renderer_info.texture_formats[i] == sdl_texture_format_map[j].texture_fmt) {
|
||||
pix_fmts[nb_pix_fmts++] = sdl_texture_format_map[j].format;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pix_fmts[nb_pix_fmts] = AV_PIX_FMT_NONE;
|
||||
|
||||
while ((e = av_dict_get(sws_dict, "", e, AV_DICT_IGNORE_SUFFIX))) {
|
||||
if (!strcmp(e->key, "sws_flags")) {
|
||||
@@ -2465,7 +2452,7 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
|
||||
else {
|
||||
memset(stream, 0, len1);
|
||||
if (!is->muted && is->audio_buf)
|
||||
SDL_MixAudio(stream, (uint8_t *)is->audio_buf + is->audio_buf_index, len1, is->audio_volume);
|
||||
SDL_MixAudioFormat(stream, (uint8_t *)is->audio_buf + is->audio_buf_index, AUDIO_S16SYS, len1, is->audio_volume);
|
||||
}
|
||||
len -= len1;
|
||||
stream += len1;
|
||||
@@ -2510,7 +2497,7 @@ static int audio_open(void *opaque, int64_t wanted_channel_layout, int wanted_nb
|
||||
wanted_spec.samples = FFMAX(SDL_AUDIO_MIN_BUFFER_SIZE, 2 << av_log2(wanted_spec.freq / SDL_AUDIO_MAX_CALLBACKS_PER_SEC));
|
||||
wanted_spec.callback = sdl_audio_callback;
|
||||
wanted_spec.userdata = opaque;
|
||||
while (SDL_OpenAudio(&wanted_spec, &spec) < 0) {
|
||||
while (!(audio_dev = SDL_OpenAudioDevice(NULL, 0, &wanted_spec, &spec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE))) {
|
||||
av_log(NULL, AV_LOG_WARNING, "SDL_OpenAudio (%d channels, %d Hz): %s\n",
|
||||
wanted_spec.channels, wanted_spec.freq, SDL_GetError());
|
||||
wanted_spec.channels = next_nb_channels[FFMIN(7, wanted_spec.channels)];
|
||||
@@ -2680,7 +2667,7 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
}
|
||||
if ((ret = decoder_start(&is->auddec, audio_thread, is)) < 0)
|
||||
goto out;
|
||||
SDL_PauseAudio(0);
|
||||
SDL_PauseAudioDevice(audio_dev, 0);
|
||||
break;
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
is->video_stream = stream_index;
|
||||
@@ -3751,6 +3738,31 @@ int main(int argc, char **argv)
|
||||
av_init_packet(&flush_pkt);
|
||||
flush_pkt.data = (uint8_t *)&flush_pkt;
|
||||
|
||||
if (!display_disable) {
|
||||
int flags = SDL_WINDOW_HIDDEN;
|
||||
if (borderless)
|
||||
flags |= SDL_WINDOW_BORDERLESS;
|
||||
else
|
||||
flags |= SDL_WINDOW_RESIZABLE;
|
||||
window = SDL_CreateWindow(program_name, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, default_width, default_height, flags);
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
||||
if (window) {
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||
if (!renderer) {
|
||||
av_log(NULL, AV_LOG_WARNING, "Failed to initialize a hardware accelerated renderer: %s\n", SDL_GetError());
|
||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||
}
|
||||
if (renderer) {
|
||||
if (!SDL_GetRendererInfo(renderer, &renderer_info))
|
||||
av_log(NULL, AV_LOG_VERBOSE, "Initialized %s renderer.\n", renderer_info.name);
|
||||
}
|
||||
}
|
||||
if (!window || !renderer || !renderer_info.num_texture_formats) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Failed to create window or renderer: %s", SDL_GetError());
|
||||
do_exit(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
is = stream_open(input_filename, file_iformat);
|
||||
if (!is) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Failed to initialize VideoState!\n");
|
||||
|
||||
+9
-13
@@ -476,7 +476,7 @@ static int compute_datarate(DataRateData *drd, int64_t count)
|
||||
static void start_children(FFServerStream *feed)
|
||||
{
|
||||
char *pathname;
|
||||
char *slash;
|
||||
char *dirname, *prog;
|
||||
int i;
|
||||
size_t cmd_length;
|
||||
|
||||
@@ -495,22 +495,18 @@ static void start_children(FFServerStream *feed)
|
||||
return;
|
||||
}
|
||||
|
||||
slash = strrchr(my_program_name, '/');
|
||||
if (!slash) {
|
||||
pathname = av_mallocz(sizeof("ffmpeg"));
|
||||
} else {
|
||||
pathname = av_mallocz(slash - my_program_name + sizeof("ffmpeg"));
|
||||
if (pathname != NULL) {
|
||||
memcpy(pathname, my_program_name, slash - my_program_name);
|
||||
}
|
||||
/* use "ffmpeg" in the path of current program. Ignore user provided path */
|
||||
prog = av_strdup(my_program_name);
|
||||
if (prog) {
|
||||
dirname = av_dirname(prog);
|
||||
pathname = *dirname ? av_asprintf("%s/%s", dirname, "ffmpeg")
|
||||
: av_asprintf("ffmpeg");
|
||||
av_free(prog);
|
||||
}
|
||||
if (!pathname) {
|
||||
if (!prog || !pathname) {
|
||||
http_log("Could not allocate memory for children cmd line\n");
|
||||
return;
|
||||
}
|
||||
/* use "ffmpeg" in the path of current program. Ignore user provided path */
|
||||
|
||||
strcat(pathname, "ffmpeg");
|
||||
|
||||
for (; feed; feed = feed->next) {
|
||||
|
||||
|
||||
@@ -307,9 +307,9 @@ static av_always_inline void predict(PredictorState *ps, int *coef,
|
||||
|
||||
if (shift < 31) {
|
||||
if (shift > 0) {
|
||||
*coef += (pv.mant + (1 << (shift - 1))) >> shift;
|
||||
*coef += (unsigned)((pv.mant + (1 << (shift - 1))) >> shift);
|
||||
} else
|
||||
*coef += pv.mant << -shift;
|
||||
*coef += (unsigned)pv.mant << -shift;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ static void apply_dependent_coupling_fixed(AACContext *ac,
|
||||
for (k = offsets[i]; k < offsets[i + 1]; k++) {
|
||||
tmp = (int)(((int64_t)src[group * 128 + k] * c + \
|
||||
(int64_t)0x1000000000) >> 37);
|
||||
dest[group * 128 + k] += tmp * (1 << shift);
|
||||
dest[group * 128 + k] += tmp * (1U << shift);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,12 +130,12 @@ static void ps_decorrelate_c(INTFLOAT (*out)[2], INTFLOAT (*delay)[2],
|
||||
INTFLOAT apd_im = in_im;
|
||||
in_re = AAC_MSUB30(link_delay_re, fractional_delay_re,
|
||||
link_delay_im, fractional_delay_im);
|
||||
in_re -= a_re;
|
||||
in_re -= (UINTFLOAT)a_re;
|
||||
in_im = AAC_MADD30(link_delay_re, fractional_delay_im,
|
||||
link_delay_im, fractional_delay_re);
|
||||
in_im -= a_im;
|
||||
ap_delay[m][n+5][0] = apd_re + AAC_MUL31(ag[m], in_re);
|
||||
ap_delay[m][n+5][1] = apd_im + AAC_MUL31(ag[m], in_im);
|
||||
in_im -= (UINTFLOAT)a_im;
|
||||
ap_delay[m][n+5][0] = apd_re + (UINTFLOAT)AAC_MUL31(ag[m], in_re);
|
||||
ap_delay[m][n+5][1] = apd_im + (UINTFLOAT)AAC_MUL31(ag[m], in_im);
|
||||
}
|
||||
out[n][0] = AAC_MUL16(transient_gain[n], in_re);
|
||||
out[n][1] = AAC_MUL16(transient_gain[n], in_im);
|
||||
|
||||
@@ -433,6 +433,7 @@ static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
|
||||
av_add_sf(FLOAT_1, sbr->e_curr[e][m]),
|
||||
av_add_sf(FLOAT_1, sbr->q_mapped[e][m]))));
|
||||
}
|
||||
sbr->gain[e][m] = av_add_sf(sbr->gain[e][m], FLOAT_MIN);
|
||||
}
|
||||
for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
|
||||
sum[0] = av_add_sf(sum[0], sbr->e_origmapped[e][m]);
|
||||
@@ -567,7 +568,8 @@ static void sbr_hf_assemble(int Y1[38][64][2],
|
||||
int A = (1-((indexsine+(kx & 1))&2));
|
||||
int B = (A^(-idx)) + idx;
|
||||
int *out = &Y1[i][kx][idx];
|
||||
int shift, round;
|
||||
int shift;
|
||||
unsigned round;
|
||||
|
||||
SoftFloat *in = sbr->s_m[e];
|
||||
for (m = 0; m+1 < m_max; m+=2) {
|
||||
@@ -580,12 +582,12 @@ static void sbr_hf_assemble(int Y1[38][64][2],
|
||||
}
|
||||
if (shift < 32) {
|
||||
round = 1 << (shift-1);
|
||||
out[2*m ] += (in[m ].mant * A + round) >> shift;
|
||||
out[2*m ] += (int)(in[m ].mant * A + round) >> shift;
|
||||
}
|
||||
|
||||
if (shift2 < 32) {
|
||||
round = 1 << (shift2-1);
|
||||
out[2*m+2] += (in[m+1].mant * B + round) >> shift2;
|
||||
out[2*m+2] += (int)(in[m+1].mant * B + round) >> shift2;
|
||||
}
|
||||
}
|
||||
if(m_max&1)
|
||||
@@ -596,7 +598,7 @@ static void sbr_hf_assemble(int Y1[38][64][2],
|
||||
return;
|
||||
} else if (shift < 32) {
|
||||
round = 1 << (shift-1);
|
||||
out[2*m ] += (in[m ].mant * A + round) >> shift;
|
||||
out[2*m ] += (int)(in[m ].mant * A + round) >> shift;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ endfunc
|
||||
zip1 v4.4S, v4.4S, v4.4S
|
||||
fmla v6.4S, v1.4S, v3.4S
|
||||
fmla v2.4S, v5.4S, v4.4S
|
||||
fcmeq v7.4S, v3.4S, #0.0
|
||||
fcmeq v7.4S, v3.4S, #0
|
||||
bif v2.16B, v6.16B, v7.16B
|
||||
st1 {v2.4S}, [x0], #16
|
||||
subs x5, x5, #2
|
||||
|
||||
@@ -64,8 +64,8 @@ static void scale_coefs (
|
||||
int dynrng,
|
||||
int len)
|
||||
{
|
||||
int i, shift, round;
|
||||
unsigned mul;
|
||||
int i, shift;
|
||||
unsigned mul, round;
|
||||
int temp, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
|
||||
|
||||
mul = (dynrng & 0x1f) + 0x20;
|
||||
|
||||
@@ -611,7 +611,7 @@ static float voice_factor(float *p_vector, float p_gain,
|
||||
AMRWB_SFR_SIZE) *
|
||||
f_gain * f_gain;
|
||||
|
||||
return (p_ener - f_ener) / (p_ener + f_ener);
|
||||
return (p_ener - f_ener) / (p_ener + f_ener + 0.01);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -336,11 +336,11 @@ function ff_sbr_hf_apply_noise_0_neon, export=1
|
||||
vld1.32 {d0}, [r0,:64]
|
||||
vld1.32 {d6}, [lr,:64]
|
||||
vld1.32 {d2[]}, [r1,:32]!
|
||||
vld1.32 {d3[]}, [r2,:32]!
|
||||
vld1.32 {d18[]}, [r2,:32]!
|
||||
vceq.f32 d4, d2, #0
|
||||
veor d2, d2, d3
|
||||
vmov d1, d0
|
||||
vmla.f32 d0, d6, d3
|
||||
vmla.f32 d0, d6, d18
|
||||
vadd.f32 s2, s2, s4
|
||||
vbif d0, d1, d4
|
||||
vst1.32 {d0}, [r0,:64]!
|
||||
|
||||
@@ -3146,6 +3146,7 @@ typedef struct AVCodecContext {
|
||||
#if FF_API_ARCH_ALPHA
|
||||
#define FF_IDCT_SIMPLEALPHA 23
|
||||
#endif
|
||||
#define FF_IDCT_NONE 24 /* Used by XvMC to extract IDCT coefficients with FF_IDCT_PERM_NONE */
|
||||
#define FF_IDCT_SIMPLEAUTO 128
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ static int cng_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return ret;
|
||||
buf_out = (int16_t *)frame->data[0];
|
||||
for (i = 0; i < avctx->frame_size; i++)
|
||||
buf_out[i] = p->filter_out[i + p->order];
|
||||
buf_out[i] = av_clip_int16(p->filter_out[i + p->order]);
|
||||
memcpy(p->filter_out, p->filter_out + avctx->frame_size,
|
||||
p->order * sizeof(*p->filter_out));
|
||||
|
||||
|
||||
@@ -753,6 +753,11 @@ static int compat_decode(AVCodecContext *avctx, AVFrame *frame,
|
||||
|
||||
av_assert0(avci->compat_decode_consumed == 0);
|
||||
|
||||
if (avci->draining_done && pkt && pkt->size != 0) {
|
||||
av_log(avctx, AV_LOG_WARNING, "Got unexpected packet after EOF\n");
|
||||
avcodec_flush_buffers(avctx);
|
||||
}
|
||||
|
||||
*got_frame = 0;
|
||||
avci->compat_decode = 1;
|
||||
|
||||
|
||||
+12
-12
@@ -93,40 +93,40 @@ void ff_spatial_idwt_slice2(DWTContext *d, int y);
|
||||
|
||||
// shared stuff for simd optimizations
|
||||
#define COMPOSE_53iL0(b0, b1, b2)\
|
||||
(b1 - ((int)(b0 + (unsigned)(b2) + 2) >> 2))
|
||||
(b1 - (unsigned)((int)(b0 + (unsigned)(b2) + 2) >> 2))
|
||||
|
||||
#define COMPOSE_DIRAC53iH0(b0, b1, b2)\
|
||||
(b1 + ((int)(b0 + (unsigned)(b2) + 1) >> 1))
|
||||
(b1 + (unsigned)((int)(b0 + (unsigned)(b2) + 1) >> 1))
|
||||
|
||||
#define COMPOSE_DD97iH0(b0, b1, b2, b3, b4)\
|
||||
(b2 + ((int)(-b0 + 9U*b1 + 9U*b3 - b4 + 8) >> 4))
|
||||
(int)(((unsigned)(b2) + ((int)(-b0 + 9U*b1 + 9U*b3 - b4 + 8) >> 4)))
|
||||
|
||||
#define COMPOSE_DD137iL0(b0, b1, b2, b3, b4)\
|
||||
(b2 - ((-b0 + 9*b1 + 9*b3 - b4 + 16) >> 5))
|
||||
(int)(((unsigned)(b2) - ((int)(-b0 + 9U*b1 + 9U*b3 - b4 + 16) >> 5)))
|
||||
|
||||
#define COMPOSE_HAARiL0(b0, b1)\
|
||||
(b0 - ((b1 + 1) >> 1))
|
||||
((int)(b0 - (unsigned)((int)(b1 + 1U) >> 1)))
|
||||
|
||||
#define COMPOSE_HAARiH0(b0, b1)\
|
||||
(b0 + b1)
|
||||
((int)(b0 + (unsigned)(b1)))
|
||||
|
||||
#define COMPOSE_FIDELITYiL0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
|
||||
(b4 - ((int)(-8*(b0+(unsigned)b8) + 21*(b1+(unsigned)b7) - 46*(b2+(unsigned)b6) + 161*(b3+(unsigned)b5) + 128) >> 8))
|
||||
((unsigned)b4 - ((int)(-8*(b0+(unsigned)b8) + 21*(b1+(unsigned)b7) - 46*(b2+(unsigned)b6) + 161*(b3+(unsigned)b5) + 128) >> 8))
|
||||
|
||||
#define COMPOSE_FIDELITYiH0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
|
||||
(b4 + ((int)(-2*(b0+(unsigned)b8) + 10*(b1+(unsigned)b7) - 25*(b2+(unsigned)b6) + 81*(b3+(unsigned)b5) + 128) >> 8))
|
||||
((unsigned)b4 + ((int)(-2*(b0+(unsigned)b8) + 10*(b1+(unsigned)b7) - 25*(b2+(unsigned)b6) + 81*(b3+(unsigned)b5) + 128) >> 8))
|
||||
|
||||
#define COMPOSE_DAUB97iL1(b0, b1, b2)\
|
||||
(b1 - ((int)(1817*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
((unsigned)(b1) - ((int)(1817*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
|
||||
#define COMPOSE_DAUB97iH1(b0, b1, b2)\
|
||||
(b1 - ((int)( 113*(b0 + (unsigned)b2) + 64) >> 7))
|
||||
((unsigned)(b1) - ((int)( 113*(b0 + (unsigned)b2) + 64) >> 7))
|
||||
|
||||
#define COMPOSE_DAUB97iL0(b0, b1, b2)\
|
||||
(b1 + ((int)( 217*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
((unsigned)(b1) + ((int)( 217*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
|
||||
#define COMPOSE_DAUB97iH0(b0, b1, b2)\
|
||||
(b1 + ((int)(6497*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
((unsigned)(b1) + ((int)(6497*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
|
||||
|
||||
#endif /* AVCODEC_DWT_H */
|
||||
|
||||
@@ -49,7 +49,7 @@ static void RENAME(vertical_compose53iL0)(uint8_t *_b0, uint8_t *_b1, uint8_t *_
|
||||
TYPE *b1 = (TYPE *)_b1;
|
||||
TYPE *b2 = (TYPE *)_b2;
|
||||
for (i = 0; i < width; i++)
|
||||
b1[i] -= (int)(b0[i] + (unsigned)b2[i] + 2) >> 2;
|
||||
b1[i] -= (unsigned)((int)(b0[i] + (unsigned)b2[i] + 2) >> 2);
|
||||
}
|
||||
|
||||
static av_always_inline void RENAME(interleave)(TYPE *dst, TYPE *src0, TYPE *src1, int w2,
|
||||
|
||||
@@ -508,16 +508,16 @@ static inline void codeblock(DiracContext *s, SubBand *b,
|
||||
}
|
||||
|
||||
if (s->codeblock_mode && !(s->old_delta_quant && blockcnt_one)) {
|
||||
int quant = b->quant;
|
||||
int quant;
|
||||
if (is_arith)
|
||||
quant += dirac_get_arith_int(c, CTX_DELTA_Q_F, CTX_DELTA_Q_DATA);
|
||||
quant = dirac_get_arith_int(c, CTX_DELTA_Q_F, CTX_DELTA_Q_DATA);
|
||||
else
|
||||
quant += dirac_get_se_golomb(gb);
|
||||
if (quant < 0) {
|
||||
quant = dirac_get_se_golomb(gb);
|
||||
if (quant > INT_MAX - b->quant || b->quant + quant < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid quant\n");
|
||||
return;
|
||||
}
|
||||
b->quant = quant;
|
||||
b->quant += quant;
|
||||
}
|
||||
|
||||
if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) {
|
||||
|
||||
@@ -159,10 +159,10 @@ static void put_signed_rect_clamped_ ## PX ## bit_c(uint8_t *_dst, int dst_strid
|
||||
int32_t *src = (int32_t *)_src; \
|
||||
for (y = 0; y < height; y++) { \
|
||||
for (x = 0; x < width; x+=4) { \
|
||||
dst[x ] = av_clip_uintp2(src[x ] + (1 << (PX - 1)), PX); \
|
||||
dst[x+1] = av_clip_uintp2(src[x+1] + (1 << (PX - 1)), PX); \
|
||||
dst[x+2] = av_clip_uintp2(src[x+2] + (1 << (PX - 1)), PX); \
|
||||
dst[x+3] = av_clip_uintp2(src[x+3] + (1 << (PX - 1)), PX); \
|
||||
dst[x ] = av_clip_uintp2(src[x ] + (1U << (PX - 1)), PX); \
|
||||
dst[x+1] = av_clip_uintp2(src[x+1] + (1U << (PX - 1)), PX); \
|
||||
dst[x+2] = av_clip_uintp2(src[x+2] + (1U << (PX - 1)), PX); \
|
||||
dst[x+3] = av_clip_uintp2(src[x+3] + (1U << (PX - 1)), PX); \
|
||||
} \
|
||||
dst += dst_stride >> 1; \
|
||||
src += src_stride >> 2; \
|
||||
|
||||
@@ -381,6 +381,10 @@ static av_always_inline int dnxhd_decode_dct_block(const DNXHDContext *ctx,
|
||||
|
||||
UPDATE_CACHE(bs, &row->gb);
|
||||
GET_VLC(len, bs, &row->gb, ctx->dc_vlc.table, DNXHD_DC_VLC_BITS, 1);
|
||||
if (len < 0) {
|
||||
ret = len;
|
||||
goto error;
|
||||
}
|
||||
if (len) {
|
||||
level = GET_CACHE(bs, &row->gb);
|
||||
LAST_SKIP_BITS(bs, &row->gb, len);
|
||||
@@ -434,7 +438,7 @@ static av_always_inline int dnxhd_decode_dct_block(const DNXHDContext *ctx,
|
||||
GET_VLC(index1, bs, &row->gb, ctx->ac_vlc.table,
|
||||
DNXHD_VLC_BITS, 2);
|
||||
}
|
||||
|
||||
error:
|
||||
CLOSE_READER(bs, &row->gb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
+5
-5
@@ -326,7 +326,7 @@ static int dx2_decode_slice_5x5(GetBitContext *gb, AVFrame *frame,
|
||||
int stride = frame->linesize[0];
|
||||
uint8_t *dst = frame->data[0] + stride * line;
|
||||
|
||||
for (y = 0; y < left && get_bits_left(gb) > 16; y++) {
|
||||
for (y = 0; y < left && get_bits_left(gb) > 6 * width; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
b = decode_sym_565(gb, lru[0], 5);
|
||||
g = decode_sym_565(gb, lru[1], is_565 ? 6 : 5);
|
||||
@@ -392,7 +392,7 @@ static int dx2_decode_slice_rgb(GetBitContext *gb, AVFrame *frame,
|
||||
int stride = frame->linesize[0];
|
||||
uint8_t *dst = frame->data[0] + stride * line;
|
||||
|
||||
for (y = 0; y < left && get_bits_left(gb) > 16; y++) {
|
||||
for (y = 0; y < left && get_bits_left(gb) > 6 * width; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
dst[x * 3 + 0] = decode_sym(gb, lru[0]);
|
||||
dst[x * 3 + 1] = decode_sym(gb, lru[1]);
|
||||
@@ -437,7 +437,7 @@ static int dx2_decode_slice_410(GetBitContext *gb, AVFrame *frame,
|
||||
uint8_t *U = frame->data[1] + (ustride >> 2) * line;
|
||||
uint8_t *V = frame->data[2] + (vstride >> 2) * line;
|
||||
|
||||
for (y = 0; y < left - 3 && get_bits_left(gb) > 16; y += 4) {
|
||||
for (y = 0; y < left - 3 && get_bits_left(gb) > 9 * width; y += 4) {
|
||||
for (x = 0; x < width; x += 4) {
|
||||
for (j = 0; j < 4; j++)
|
||||
for (i = 0; i < 4; i++)
|
||||
@@ -481,7 +481,7 @@ static int dx2_decode_slice_420(GetBitContext *gb, AVFrame *frame,
|
||||
uint8_t *V = frame->data[2] + (vstride >> 1) * line;
|
||||
|
||||
|
||||
for (y = 0; y < left - 1 && get_bits_left(gb) > 16; y += 2) {
|
||||
for (y = 0; y < left - 1 && get_bits_left(gb) > 6 * width; y += 2) {
|
||||
for (x = 0; x < width; x += 2) {
|
||||
Y[x + 0 + 0 * ystride] = decode_sym(gb, lru[0]);
|
||||
Y[x + 1 + 0 * ystride] = decode_sym(gb, lru[0]);
|
||||
@@ -524,7 +524,7 @@ static int dx2_decode_slice_444(GetBitContext *gb, AVFrame *frame,
|
||||
uint8_t *U = frame->data[1] + ustride * line;
|
||||
uint8_t *V = frame->data[2] + vstride * line;
|
||||
|
||||
for (y = 0; y < left && get_bits_left(gb) > 16; y++) {
|
||||
for (y = 0; y < left && get_bits_left(gb) > 6 * width; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
Y[x] = decode_sym(gb, lru[0]);
|
||||
U[x] = decode_sym(gb, lru[1]) ^ 0x80;
|
||||
|
||||
+61
-31
@@ -855,7 +855,7 @@ static int pxr24_uncompress(EXRContext *s, const uint8_t *src,
|
||||
in = ptr[2] + td->xsize;
|
||||
|
||||
for (j = 0; j < td->xsize; ++j) {
|
||||
uint32_t diff = (*(ptr[0]++) << 24) |
|
||||
uint32_t diff = ((unsigned)*(ptr[0]++) << 24) |
|
||||
(*(ptr[1]++) << 16) |
|
||||
(*(ptr[2]++) << 8);
|
||||
pixel += diff;
|
||||
@@ -1051,7 +1051,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
line_offset = AV_RL64(s->gb.buffer + jobnr * 8);
|
||||
|
||||
if (s->is_tile) {
|
||||
if (line_offset > buf_size - 20)
|
||||
if (buf_size < 20 || line_offset > buf_size - 20)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
src = buf + line_offset + 20;
|
||||
@@ -1062,7 +1062,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
tile_level_y = AV_RL32(src - 8);
|
||||
|
||||
data_size = AV_RL32(src - 4);
|
||||
if (data_size <= 0 || data_size > buf_size)
|
||||
if (data_size <= 0 || data_size > buf_size - line_offset - 20)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (tile_level_x || tile_level_y) { /* tile level, is not the full res level */
|
||||
@@ -1095,7 +1095,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
td->channel_line_size = td->xsize * s->current_channel_offset;/* uncompress size of one line */
|
||||
uncompressed_size = td->channel_line_size * (uint64_t)td->ysize;/* uncompress size of the block */
|
||||
} else {
|
||||
if (line_offset > buf_size - 8)
|
||||
if (buf_size < 8 || line_offset > buf_size - 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
src = buf + line_offset + 8;
|
||||
@@ -1105,7 +1105,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
data_size = AV_RL32(src - 4);
|
||||
if (data_size <= 0 || data_size > buf_size)
|
||||
if (data_size <= 0 || data_size > buf_size - line_offset - 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
td->ysize = FFMIN(s->scan_lines_per_block, s->ymax - line + 1); /* s->ydelta - line ?? */
|
||||
@@ -1306,6 +1306,7 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
AVDictionary *metadata = NULL;
|
||||
int magic_number, version, i, flags, sar = 0;
|
||||
int layer_match = 0;
|
||||
int ret;
|
||||
|
||||
s->current_channel_offset = 0;
|
||||
s->xmin = ~0;
|
||||
@@ -1364,8 +1365,10 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
if ((var_size = check_header_variable(s, "channels",
|
||||
"chlist", 38)) >= 0) {
|
||||
GetByteContext ch_gb;
|
||||
if (!var_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!var_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bytestream2_init(&ch_gb, s->gb.buffer, var_size);
|
||||
|
||||
@@ -1424,14 +1427,16 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
|
||||
if (bytestream2_get_bytes_left(&ch_gb) < 4) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Incomplete header.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
current_pixel_type = bytestream2_get_le32(&ch_gb);
|
||||
if (current_pixel_type >= EXR_UNKNOWN) {
|
||||
avpriv_report_missing_feature(s->avctx, "Pixel type %d",
|
||||
current_pixel_type);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bytestream2_skip(&ch_gb, 4);
|
||||
@@ -1442,7 +1447,8 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
avpriv_report_missing_feature(s->avctx,
|
||||
"Subsampling %dx%d",
|
||||
xsub, ysub);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (channel_index >= 0 && s->channel_offsets[channel_index] == -1) { /* channel has not been previously assigned */
|
||||
@@ -1450,7 +1456,8 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
s->pixel_type != current_pixel_type) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"RGB channels not of the same depth.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
s->pixel_type = current_pixel_type;
|
||||
s->channel_offsets[channel_index] = s->current_channel_offset;
|
||||
@@ -1458,8 +1465,10 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
|
||||
s->channels = av_realloc(s->channels,
|
||||
++s->nb_channels * sizeof(EXRChannel));
|
||||
if (!s->channels)
|
||||
return AVERROR(ENOMEM);
|
||||
if (!s->channels) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
channel = &s->channels[s->nb_channels - 1];
|
||||
channel->pixel_type = current_pixel_type;
|
||||
channel->xsub = xsub;
|
||||
@@ -1484,7 +1493,8 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Missing green channel.\n");
|
||||
if (s->channel_offsets[2] < 0)
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Missing blue channel.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1493,8 +1503,10 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
continue;
|
||||
} else if ((var_size = check_header_variable(s, "dataWindow", "box2i",
|
||||
31)) >= 0) {
|
||||
if (!var_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!var_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
s->xmin = bytestream2_get_le32(&s->gb);
|
||||
s->ymin = bytestream2_get_le32(&s->gb);
|
||||
@@ -1506,8 +1518,10 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
continue;
|
||||
} else if ((var_size = check_header_variable(s, "displayWindow",
|
||||
"box2i", 34)) >= 0) {
|
||||
if (!var_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!var_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bytestream2_skip(&s->gb, 8);
|
||||
s->w = bytestream2_get_le32(&s->gb) + 1;
|
||||
@@ -1517,29 +1531,36 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
} else if ((var_size = check_header_variable(s, "lineOrder",
|
||||
"lineOrder", 25)) >= 0) {
|
||||
int line_order;
|
||||
if (!var_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!var_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
line_order = bytestream2_get_byte(&s->gb);
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "line order: %d.\n", line_order);
|
||||
if (line_order > 2) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Unknown line order.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
continue;
|
||||
} else if ((var_size = check_header_variable(s, "pixelAspectRatio",
|
||||
"float", 31)) >= 0) {
|
||||
if (!var_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!var_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sar = bytestream2_get_le32(&s->gb);
|
||||
|
||||
continue;
|
||||
} else if ((var_size = check_header_variable(s, "compression",
|
||||
"compression", 29)) >= 0) {
|
||||
if (!var_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!var_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (s->compression == EXR_UNKN)
|
||||
s->compression = bytestream2_get_byte(&s->gb);
|
||||
@@ -1566,13 +1587,15 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
if (s->tile_attr.level_mode >= EXR_TILE_LEVEL_UNKNOWN){
|
||||
avpriv_report_missing_feature(s->avctx, "Tile level mode %d",
|
||||
s->tile_attr.level_mode);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (s->tile_attr.level_round >= EXR_TILE_ROUND_UNKNOWN) {
|
||||
avpriv_report_missing_feature(s->avctx, "Tile level round %d",
|
||||
s->tile_attr.level_round);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
continue;
|
||||
@@ -1589,7 +1612,8 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
// Check if there are enough bytes for a header
|
||||
if (bytestream2_get_bytes_left(&s->gb) <= 9) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Incomplete header\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// Process unknown variables
|
||||
@@ -1604,19 +1628,22 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
|
||||
if (s->compression == EXR_UNKN) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Missing compression attribute.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (s->is_tile) {
|
||||
if (s->tile_attr.xSize < 1 || s->tile_attr.ySize < 1) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid tile attribute.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
if (bytestream2_get_bytes_left(&s->gb) <= 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Incomplete frame.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
frame->metadata = metadata;
|
||||
@@ -1624,6 +1651,9 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
// aaand we are done
|
||||
bytestream2_skip(&s->gb, 1);
|
||||
return 0;
|
||||
fail:
|
||||
av_dict_free(&metadata);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
@@ -78,7 +78,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt,
|
||||
ret = ff_h2645_packet_split(&h2645_pkt, pkt->data, pkt->size,
|
||||
ctx, 0, 0, ctx->par_in->codec_id, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto fail;
|
||||
|
||||
for (i = 0; i < h2645_pkt.nb_nals; i++) {
|
||||
H2645NAL *nal = &h2645_pkt.nals[i];
|
||||
|
||||
@@ -298,7 +298,7 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded,
|
||||
if (pred_order > 2)
|
||||
c = b - decoded[pred_order-2] + decoded[pred_order-3];
|
||||
if (pred_order > 3)
|
||||
d = c - decoded[pred_order-2] + 2*decoded[pred_order-3] - decoded[pred_order-4];
|
||||
d = c - decoded[pred_order-2] + 2U*decoded[pred_order-3] - decoded[pred_order-4];
|
||||
|
||||
switch (pred_order) {
|
||||
case 0:
|
||||
@@ -456,7 +456,7 @@ static inline int decode_subframe(FLACContext *s, int channel)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (wasted) {
|
||||
if (wasted && wasted < 32) {
|
||||
int i;
|
||||
for (i = 0; i < s->blocksize; i++)
|
||||
decoded[i] = (unsigned)decoded[i] << wasted;
|
||||
|
||||
@@ -550,6 +550,7 @@ static inline const uint8_t *align_get_bits(GetBitContext *s)
|
||||
* @param max_depth is the number of times bits bits must be read to completely
|
||||
* read the longest vlc code
|
||||
* = (max_vlc_length + bits - 1) / bits
|
||||
* @returns the code parsed or -1 if no vlc matches
|
||||
*/
|
||||
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2],
|
||||
int bits, int max_depth)
|
||||
|
||||
@@ -425,10 +425,9 @@ static int decode_extradata_ps_mp4(const uint8_t *buf, int buf_size, H264ParamSe
|
||||
escaped_buf_size = bytestream2_tell_p(&pbc);
|
||||
AV_WB16(escaped_buf, escaped_buf_size - 2);
|
||||
|
||||
ret = decode_extradata_ps(escaped_buf, escaped_buf_size, ps, 1, logctx);
|
||||
(void)decode_extradata_ps(escaped_buf, escaped_buf_size, ps, 1, logctx);
|
||||
// lorex.mp4 decodes ok even with extradata decoding failing
|
||||
av_freep(&escaped_buf);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1577,6 +1577,12 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
|
||||
* one except for reference purposes. */
|
||||
h->first_field = 1;
|
||||
h->cur_pic_ptr = NULL;
|
||||
} else if (h->cur_pic_ptr->reference & DELAYED_PIC_REF) {
|
||||
/* This frame was already output, we cannot draw into it
|
||||
* anymore.
|
||||
*/
|
||||
h->first_field = 1;
|
||||
h->cur_pic_ptr = NULL;
|
||||
} else {
|
||||
/* Second field in complementary pair */
|
||||
h->first_field = 0;
|
||||
|
||||
@@ -35,10 +35,10 @@ static void FUNCC(ff_h264_add_pixels4)(uint8_t *_dst, int16_t *_src, int stride)
|
||||
stride /= sizeof(pixel);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
dst[0] += src[0];
|
||||
dst[1] += src[1];
|
||||
dst[2] += src[2];
|
||||
dst[3] += src[3];
|
||||
dst[0] += (unsigned)src[0];
|
||||
dst[1] += (unsigned)src[1];
|
||||
dst[2] += (unsigned)src[2];
|
||||
dst[3] += (unsigned)src[3];
|
||||
|
||||
dst += stride;
|
||||
src += 4;
|
||||
@@ -55,14 +55,14 @@ static void FUNCC(ff_h264_add_pixels8)(uint8_t *_dst, int16_t *_src, int stride)
|
||||
stride /= sizeof(pixel);
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
dst[0] += src[0];
|
||||
dst[1] += src[1];
|
||||
dst[2] += src[2];
|
||||
dst[3] += src[3];
|
||||
dst[4] += src[4];
|
||||
dst[5] += src[5];
|
||||
dst[6] += src[6];
|
||||
dst[7] += src[7];
|
||||
dst[0] += (unsigned)src[0];
|
||||
dst[1] += (unsigned)src[1];
|
||||
dst[2] += (unsigned)src[2];
|
||||
dst[3] += (unsigned)src[3];
|
||||
dst[4] += (unsigned)src[4];
|
||||
dst[5] += (unsigned)src[5];
|
||||
dst[6] += (unsigned)src[6];
|
||||
dst[7] += (unsigned)src[7];
|
||||
|
||||
dst += stride;
|
||||
src += 8;
|
||||
|
||||
@@ -416,6 +416,7 @@ typedef struct H264Context {
|
||||
uint8_t (*mvd_table[2])[2];
|
||||
uint8_t *direct_table;
|
||||
|
||||
uint8_t scan_padding[16];
|
||||
uint8_t zigzag_scan[16];
|
||||
uint8_t zigzag_scan8x8[64];
|
||||
uint8_t zigzag_scan8x8_cavlc[64];
|
||||
|
||||
@@ -76,10 +76,10 @@ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride){
|
||||
|
||||
for( i = 0; i < 8; i++ )
|
||||
{
|
||||
const unsigned int a0 = block[i+0*8] + block[i+4*8];
|
||||
const unsigned int a2 = block[i+0*8] - block[i+4*8];
|
||||
const unsigned int a4 = (block[i+2*8]>>1) - block[i+6*8];
|
||||
const unsigned int a6 = (block[i+6*8]>>1) + block[i+2*8];
|
||||
const unsigned int a0 = block[i+0*8] + (unsigned)block[i+4*8];
|
||||
const unsigned int a2 = block[i+0*8] - (unsigned)block[i+4*8];
|
||||
const unsigned int a4 = (block[i+2*8]>>1) - (unsigned)block[i+6*8];
|
||||
const unsigned int a6 = (block[i+6*8]>>1) + (unsigned)block[i+2*8];
|
||||
|
||||
const unsigned int b0 = a0 + a6;
|
||||
const unsigned int b2 = a2 + a4;
|
||||
@@ -91,10 +91,10 @@ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride){
|
||||
const int a5 = -block[i+1*8] + (unsigned)block[i+7*8] + block[i+5*8] + (block[i+5*8]>>1);
|
||||
const int a7 = block[i+3*8] + (unsigned)block[i+5*8] + block[i+1*8] + (block[i+1*8]>>1);
|
||||
|
||||
const int b1 = (a7>>2) + a1;
|
||||
const int b3 = a3 + (a5>>2);
|
||||
const int b5 = (a3>>2) - a5;
|
||||
const int b7 = a7 - (a1>>2);
|
||||
const int b1 = (a7>>2) + (unsigned)a1;
|
||||
const int b3 = (unsigned)a3 + (a5>>2);
|
||||
const int b5 = (a3>>2) - (unsigned)a5;
|
||||
const int b7 = (unsigned)a7 - (a1>>2);
|
||||
|
||||
block[i+0*8] = b0 + b7;
|
||||
block[i+7*8] = b0 - b7;
|
||||
@@ -107,10 +107,10 @@ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride){
|
||||
}
|
||||
for( i = 0; i < 8; i++ )
|
||||
{
|
||||
const unsigned a0 = block[0+i*8] + block[4+i*8];
|
||||
const unsigned a2 = block[0+i*8] - block[4+i*8];
|
||||
const unsigned a4 = (block[2+i*8]>>1) - block[6+i*8];
|
||||
const unsigned a6 = (block[6+i*8]>>1) + block[2+i*8];
|
||||
const unsigned a0 = block[0+i*8] + (unsigned)block[4+i*8];
|
||||
const unsigned a2 = block[0+i*8] - (unsigned)block[4+i*8];
|
||||
const unsigned a4 = (block[2+i*8]>>1) - (unsigned)block[6+i*8];
|
||||
const unsigned a6 = (block[6+i*8]>>1) + (unsigned)block[2+i*8];
|
||||
|
||||
const unsigned b0 = a0 + a6;
|
||||
const unsigned b2 = a2 + a4;
|
||||
|
||||
+10
-5
@@ -646,8 +646,10 @@ int ff_hevc_cu_qp_delta_abs(HEVCContext *s)
|
||||
suffix_val += 1 << k;
|
||||
k++;
|
||||
}
|
||||
if (k == CABAC_MAX_BIN)
|
||||
if (k == CABAC_MAX_BIN) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
while (k--)
|
||||
suffix_val += get_cabac_bypass(&s->HEVClc->cc) << k;
|
||||
@@ -988,16 +990,19 @@ static av_always_inline int coeff_abs_level_remaining_decode(HEVCContext *s, int
|
||||
|
||||
while (prefix < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc))
|
||||
prefix++;
|
||||
if (prefix == CABAC_MAX_BIN) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (prefix < 3) {
|
||||
for (i = 0; i < rc_rice_param; i++)
|
||||
suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc);
|
||||
last_coeff_abs_level_remaining = (prefix << rc_rice_param) + suffix;
|
||||
} else {
|
||||
int prefix_minus3 = prefix - 3;
|
||||
|
||||
if (prefix == CABAC_MAX_BIN || prefix_minus3 + rc_rice_param >= 31) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < prefix_minus3 + rc_rice_param; i++)
|
||||
suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc);
|
||||
last_coeff_abs_level_remaining = (((1 << prefix_minus3) + 3 - 1)
|
||||
|
||||
@@ -359,17 +359,8 @@ static int hevc_split(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
|
||||
static void hevc_parser_close(AVCodecParserContext *s)
|
||||
{
|
||||
HEVCParserContext *ctx = s->priv_data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.vps_list); i++)
|
||||
av_buffer_unref(&ctx->ps.vps_list[i]);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.sps_list); i++)
|
||||
av_buffer_unref(&ctx->ps.sps_list[i]);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.pps_list); i++)
|
||||
av_buffer_unref(&ctx->ps.pps_list[i]);
|
||||
|
||||
ctx->ps.sps = NULL;
|
||||
|
||||
ff_hevc_ps_uninit(&ctx->ps);
|
||||
ff_h2645_packet_uninit(&ctx->pkt);
|
||||
ff_hevc_reset_sei(&ctx->sei);
|
||||
|
||||
|
||||
@@ -1324,6 +1324,11 @@ static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx,
|
||||
pps->log2_sao_offset_scale_luma = get_ue_golomb_long(gb);
|
||||
pps->log2_sao_offset_scale_chroma = get_ue_golomb_long(gb);
|
||||
|
||||
if ( pps->log2_sao_offset_scale_luma > FFMAX(sps->bit_depth - 10, 0)
|
||||
|| pps->log2_sao_offset_scale_chroma > FFMAX(sps->bit_depth_chroma - 10, 0)
|
||||
)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1704,6 +1709,22 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ff_hevc_ps_uninit(HEVCParamSets *ps)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(ps->vps_list); i++)
|
||||
av_buffer_unref(&ps->vps_list[i]);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(ps->sps_list); i++)
|
||||
av_buffer_unref(&ps->sps_list[i]);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(ps->pps_list); i++)
|
||||
av_buffer_unref(&ps->pps_list[i]);
|
||||
|
||||
ps->sps = NULL;
|
||||
ps->pps = NULL;
|
||||
ps->vps = NULL;
|
||||
}
|
||||
|
||||
int ff_hevc_compute_poc(const HEVCSPS *sps, int pocTid0, int poc_lsb, int nal_unit_type)
|
||||
{
|
||||
int max_poc_lsb = 1 << sps->log2_max_poc_lsb;
|
||||
|
||||
@@ -421,6 +421,8 @@ int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
HEVCParamSets *ps);
|
||||
|
||||
void ff_hevc_ps_uninit(HEVCParamSets *ps);
|
||||
|
||||
int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header);
|
||||
|
||||
|
||||
@@ -324,11 +324,15 @@ static int decode_nal_sei_message(GetBitContext *gb, HEVCSEIContext *s,
|
||||
av_log(logctx, AV_LOG_DEBUG, "Decoding SEI\n");
|
||||
|
||||
while (byte == 0xFF) {
|
||||
if (get_bits_left(gb) < 16 || payload_type > INT_MAX - 255)
|
||||
return AVERROR_INVALIDDATA;
|
||||
byte = get_bits(gb, 8);
|
||||
payload_type += byte;
|
||||
}
|
||||
byte = 0xFF;
|
||||
while (byte == 0xFF) {
|
||||
if (get_bits_left(gb) < 8 + 8LL*payload_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
byte = get_bits(gb, 8);
|
||||
payload_size += byte;
|
||||
}
|
||||
|
||||
@@ -3215,15 +3215,7 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx)
|
||||
av_frame_free(&s->DPB[i].frame);
|
||||
}
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->ps.vps_list); i++)
|
||||
av_buffer_unref(&s->ps.vps_list[i]);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++)
|
||||
av_buffer_unref(&s->ps.sps_list[i]);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->ps.pps_list); i++)
|
||||
av_buffer_unref(&s->ps.pps_list[i]);
|
||||
s->ps.sps = NULL;
|
||||
s->ps.pps = NULL;
|
||||
s->ps.vps = NULL;
|
||||
ff_hevc_ps_uninit(&s->ps);
|
||||
|
||||
av_freep(&s->sh.entry_point_offset);
|
||||
av_freep(&s->sh.offset);
|
||||
|
||||
@@ -121,7 +121,7 @@ static void FUNC(dequant)(int16_t *coeffs, int16_t log2_size)
|
||||
} else {
|
||||
for (y = 0; y < size; y++) {
|
||||
for (x = 0; x < size; x++) {
|
||||
*coeffs = *coeffs << -shift;
|
||||
*coeffs = *(uint16_t*)coeffs << -shift;
|
||||
coeffs++;
|
||||
}
|
||||
}
|
||||
@@ -915,7 +915,7 @@ static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
|
||||
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
|
||||
((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
|
||||
src += srcstride;
|
||||
dst += dststride;
|
||||
src2 += MAX_PB_SIZE;
|
||||
@@ -970,7 +970,7 @@ static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
|
||||
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
|
||||
((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
|
||||
src += srcstride;
|
||||
dst += dststride;
|
||||
src2 += MAX_PB_SIZE;
|
||||
@@ -1051,7 +1051,7 @@ static void FUNC(put_hevc_qpel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uin
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = av_clip_pixel(((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 +
|
||||
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
|
||||
((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
|
||||
tmp += MAX_PB_SIZE;
|
||||
dst += dststride;
|
||||
src2 += MAX_PB_SIZE;
|
||||
@@ -1355,7 +1355,7 @@ static void FUNC(put_hevc_epel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = av_clip_pixel(((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
|
||||
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
|
||||
((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
|
||||
src += srcstride;
|
||||
dst += dststride;
|
||||
src2 += MAX_PB_SIZE;
|
||||
@@ -1407,7 +1407,7 @@ static void FUNC(put_hevc_epel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = av_clip_pixel(((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
|
||||
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
|
||||
((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
|
||||
src += srcstride;
|
||||
dst += dststride;
|
||||
src2 += MAX_PB_SIZE;
|
||||
|
||||
@@ -919,6 +919,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
AVFrame *const p = data;
|
||||
int table_size = 0, ret;
|
||||
|
||||
if (buf_size < (width * height + 7)/8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
av_fast_padded_malloc(&s->bitstream_buffer,
|
||||
&s->bitstream_buffer_size,
|
||||
buf_size);
|
||||
|
||||
@@ -279,6 +279,7 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
|
||||
c->perm_type = FF_IDCT_PERM_NONE;
|
||||
#endif /* CONFIG_FAANIDCT */
|
||||
} else { // accurate/default
|
||||
/* Be sure FF_IDCT_NONE will select this one, since it uses FF_IDCT_PERM_NONE */
|
||||
c->idct_put = ff_simple_idct_put_8;
|
||||
c->idct_add = ff_simple_idct_add_8;
|
||||
c->idct = ff_simple_idct_8;
|
||||
|
||||
@@ -324,6 +324,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
ctx->frame_type = get_bits(&ctx->gb, 3);
|
||||
if (ctx->frame_type >= 5) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid frame type: %d \n", ctx->frame_type);
|
||||
ctx->frame_type = FRAMETYPE_INTRA;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -688,7 +688,8 @@ static void encode_cblk(Jpeg2000EncoderContext *s, Jpeg2000T1Context *t1, Jpeg20
|
||||
cblk->npasses = passno;
|
||||
cblk->ninclpasses = passno;
|
||||
|
||||
cblk->passes[passno-1].rate = ff_mqc_flush_to(&t1->mqc, cblk->passes[passno-1].flushed, &cblk->passes[passno-1].flushed_len);
|
||||
if (passno)
|
||||
cblk->passes[passno-1].rate = ff_mqc_flush_to(&t1->mqc, cblk->passes[passno-1].flushed, &cblk->passes[passno-1].flushed_len);
|
||||
}
|
||||
|
||||
/* tier-2 routines: */
|
||||
|
||||
@@ -543,6 +543,9 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
|
||||
if (!reslevel->band)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
if (reslevel->num_precincts_x * (uint64_t)reslevel->num_precincts_y * reslevel->nbands > avctx->max_pixels / sizeof(*reslevel->band->prec))
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
for (bandno = 0; bandno < reslevel->nbands; bandno++, gbandno++) {
|
||||
ret = init_band(avctx, reslevel,
|
||||
comp, codsty, qntsty,
|
||||
|
||||
@@ -64,9 +64,9 @@ static void ict_int(void *_src0, void *_src1, void *_src2, int csize)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < csize; i++) {
|
||||
i0 = *src0 + *src2 + (((26345 * *src2) + (1 << 15)) >> 16);
|
||||
i0 = *src0 + *src2 + ((int)((26345U * *src2) + (1 << 15)) >> 16);
|
||||
i1 = *src0 - ((int)(((unsigned)i_ict_params[1] * *src1) + (1 << 15)) >> 16)
|
||||
- (((i_ict_params[2] * *src2) + (1 << 15)) >> 16);
|
||||
- ((int)(((unsigned)i_ict_params[2] * *src2) + (1 << 15)) >> 16);
|
||||
i2 = *src0 + (2 * *src1) + ((int)((-14942U * *src1) + (1 << 15)) >> 16);
|
||||
*src0++ = i0;
|
||||
*src1++ = i1;
|
||||
|
||||
@@ -233,6 +233,9 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s,
|
||||
while (x < w) {
|
||||
int err, pred;
|
||||
|
||||
if (get_bits_left(&s->gb) <= 0)
|
||||
return;
|
||||
|
||||
/* compute gradients */
|
||||
Ra = x ? R(dst, x - stride) : R(last, x);
|
||||
Rb = R(last, x);
|
||||
@@ -443,6 +446,10 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
|
||||
avpriv_report_missing_feature(s->avctx, "Sample interleaved images");
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto end;
|
||||
} else { /* unknown interleaving */
|
||||
avpriv_report_missing_feature(s->avctx, "Unknown interleaved images");
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (s->xfrm && s->nb_components == 3) {
|
||||
|
||||
@@ -62,6 +62,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
h = (buf[1] + 1) * 8;
|
||||
buf += 2;
|
||||
|
||||
if (avpkt->size < 2 + w*h / 513)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (w != avctx->width || h != avctx->height) {
|
||||
av_freep(&c->frame_buffer);
|
||||
av_freep(&c->last_frame_buffer);
|
||||
|
||||
+27
-1
@@ -272,6 +272,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
|
||||
int *got_packet)
|
||||
{
|
||||
X264Context *x4 = ctx->priv_data;
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(ctx->pix_fmt);
|
||||
x264_nal_t *nal;
|
||||
int nnal, i, ret;
|
||||
x264_picture_t pic_out = {0};
|
||||
@@ -279,7 +280,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
|
||||
|
||||
x264_picture_init( &x4->pic );
|
||||
x4->pic.img.i_csp = x4->params.i_csp;
|
||||
if (x264_bit_depth > 8)
|
||||
if (desc->comp[0].depth > 8)
|
||||
x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH;
|
||||
x4->pic.img.i_plane = avfmt2_num_planes(ctx->pix_fmt);
|
||||
|
||||
@@ -739,6 +740,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
x4->params.i_width = avctx->width;
|
||||
x4->params.i_height = avctx->height;
|
||||
#if X264_BUILD >= 153
|
||||
x4->params.i_bitdepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth;
|
||||
#endif
|
||||
av_reduce(&sw, &sh, avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den, 4096);
|
||||
x4->params.vui.i_sar_width = sw;
|
||||
x4->params.vui.i_sar_height = sh;
|
||||
@@ -852,6 +856,24 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const enum AVPixelFormat pix_fmts[] = {
|
||||
AV_PIX_FMT_YUV420P,
|
||||
AV_PIX_FMT_YUVJ420P,
|
||||
AV_PIX_FMT_YUV422P,
|
||||
AV_PIX_FMT_YUVJ422P,
|
||||
AV_PIX_FMT_YUV444P,
|
||||
AV_PIX_FMT_YUVJ444P,
|
||||
AV_PIX_FMT_YUV420P10,
|
||||
AV_PIX_FMT_YUV422P10,
|
||||
AV_PIX_FMT_YUV444P10,
|
||||
AV_PIX_FMT_NV12,
|
||||
AV_PIX_FMT_NV16,
|
||||
AV_PIX_FMT_NV20,
|
||||
#ifdef X264_CSP_NV21
|
||||
AV_PIX_FMT_NV21,
|
||||
#endif
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
static const enum AVPixelFormat pix_fmts_8bit[] = {
|
||||
AV_PIX_FMT_YUV420P,
|
||||
AV_PIX_FMT_YUVJ420P,
|
||||
@@ -889,12 +911,16 @@ static const enum AVPixelFormat pix_fmts_8bit_rgb[] = {
|
||||
|
||||
static av_cold void X264_init_static(AVCodec *codec)
|
||||
{
|
||||
#if X264_BUILD < 153
|
||||
if (x264_bit_depth == 8)
|
||||
codec->pix_fmts = pix_fmts_8bit;
|
||||
else if (x264_bit_depth == 9)
|
||||
codec->pix_fmts = pix_fmts_9bit;
|
||||
else if (x264_bit_depth == 10)
|
||||
codec->pix_fmts = pix_fmts_10bit;
|
||||
#else
|
||||
codec->pix_fmts = pix_fmts;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define OFFSET(x) offsetof(X264Context, x)
|
||||
|
||||
@@ -39,13 +39,13 @@ void ff_mdct_calcw_c(FFTContext *s, FFTDouble *out, const FFTSample *input)
|
||||
|
||||
/* pre rotation */
|
||||
for(i=0;i<n8;i++) {
|
||||
re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]);
|
||||
im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]);
|
||||
re = RSCALE(-input[2*i+n3], - input[n3-1-2*i]);
|
||||
im = RSCALE(-input[n4+2*i], + input[n4-1-2*i]);
|
||||
j = revtab[i];
|
||||
CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]);
|
||||
|
||||
re = RSCALE( input[2*i] - input[n2-1-2*i]);
|
||||
im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]);
|
||||
re = RSCALE( input[2*i] , - input[n2-1-2*i]);
|
||||
im = RSCALE(-input[n2+2*i], - input[ n-1-2*i]);
|
||||
j = revtab[n8 + i];
|
||||
CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
|
||||
}
|
||||
|
||||
@@ -33,12 +33,12 @@
|
||||
*/
|
||||
|
||||
#if FFT_FLOAT
|
||||
# define RSCALE(x) (x)
|
||||
# define RSCALE(x, y) ((x) + (y))
|
||||
#else
|
||||
#if FFT_FIXED_32
|
||||
# define RSCALE(x) (((x) + 32) >> 6)
|
||||
# define RSCALE(x, y) ((int)((x) + (unsigned)(y) + 32) >> 6)
|
||||
#else /* FFT_FIXED_32 */
|
||||
# define RSCALE(x) ((x) >> 1)
|
||||
# define RSCALE(x, y) ((int)((x) + (unsigned)(y)) >> 1)
|
||||
#endif /* FFT_FIXED_32 */
|
||||
#endif
|
||||
|
||||
@@ -181,13 +181,13 @@ void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input)
|
||||
|
||||
/* pre rotation */
|
||||
for(i=0;i<n8;i++) {
|
||||
re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]);
|
||||
im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]);
|
||||
re = RSCALE(-input[2*i+n3], - input[n3-1-2*i]);
|
||||
im = RSCALE(-input[n4+2*i], + input[n4-1-2*i]);
|
||||
j = revtab[i];
|
||||
CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]);
|
||||
|
||||
re = RSCALE( input[2*i] - input[n2-1-2*i]);
|
||||
im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]);
|
||||
re = RSCALE( input[2*i] , - input[n2-1-2*i]);
|
||||
im = RSCALE(-input[n2+2*i], - input[ n-1-2*i]);
|
||||
j = revtab[n8 + i];
|
||||
CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
|
||||
}
|
||||
|
||||
@@ -256,6 +256,8 @@ static int hevc_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
|
||||
}
|
||||
|
||||
done:
|
||||
ff_hevc_ps_uninit(&ps);
|
||||
|
||||
av_freep(&vps_data);
|
||||
av_freep(&sps_data);
|
||||
av_freep(&pps_data);
|
||||
|
||||
@@ -715,7 +715,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,
|
||||
av_log(s->avctx, AV_LOG_ERROR, "error dc\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
val = val * quant_matrix[0] + s->last_dc[component];
|
||||
val = val * (unsigned)quant_matrix[0] + s->last_dc[component];
|
||||
val = av_clip_int16(val);
|
||||
s->last_dc[component] = val;
|
||||
block[0] = val;
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ int32_t ff_mlp_pack_output(int32_t lossless_check_data,
|
||||
(1U << output_shift[mat_ch]);
|
||||
lossless_check_data ^= (sample & 0xffffff) << mat_ch;
|
||||
if (is32)
|
||||
*data_32++ = sample << 8;
|
||||
*data_32++ = sample * 256U;
|
||||
else
|
||||
*data_16++ = sample >> 8;
|
||||
}
|
||||
|
||||
@@ -1217,7 +1217,7 @@ static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx)
|
||||
#endif
|
||||
)
|
||||
if (avctx->idct_algo == FF_IDCT_AUTO)
|
||||
avctx->idct_algo = FF_IDCT_SIMPLE;
|
||||
avctx->idct_algo = FF_IDCT_NONE;
|
||||
|
||||
if (avctx->hwaccel && avctx->pix_fmt == AV_PIX_FMT_XVMC) {
|
||||
Mpeg1Context *s1 = avctx->priv_data;
|
||||
@@ -1984,6 +1984,8 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
|
||||
s->mv[0][0][1] = s->last_mv[0][0][1];
|
||||
s->mv[1][0][0] = s->last_mv[1][0][0];
|
||||
s->mv[1][0][1] = s->last_mv[1][0][1];
|
||||
s->field_select[0][0] = (s->picture_structure - 1) & 1;
|
||||
s->field_select[1][0] = (s->picture_structure - 1) & 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx)
|
||||
}
|
||||
|
||||
mb_num = get_bits(&s->gb, mb_num_bits);
|
||||
if (mb_num >= s->mb_num) {
|
||||
if (mb_num >= s->mb_num || !mb_num) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num);
|
||||
return -1;
|
||||
@@ -1251,10 +1251,12 @@ not_coded:
|
||||
*/
|
||||
static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
{
|
||||
Mpeg4DecContext *ctx = (Mpeg4DecContext *)s;
|
||||
Mpeg4DecContext *ctx = s->avctx->priv_data;
|
||||
int cbp, mb_type;
|
||||
const int xy = s->mb_x + s->mb_y * s->mb_stride;
|
||||
|
||||
av_assert2(s == (void*)ctx);
|
||||
|
||||
mb_type = s->current_picture.mb_type[xy];
|
||||
cbp = s->cbp_table[xy];
|
||||
|
||||
@@ -1336,12 +1338,13 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
|
||||
static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
{
|
||||
Mpeg4DecContext *ctx = (Mpeg4DecContext *)s;
|
||||
Mpeg4DecContext *ctx = s->avctx->priv_data;
|
||||
int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
|
||||
int16_t *mot_val;
|
||||
static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
|
||||
const int xy = s->mb_x + s->mb_y * s->mb_stride;
|
||||
|
||||
av_assert2(s == (void*)ctx);
|
||||
av_assert2(s->h263_pred);
|
||||
|
||||
if (s->pict_type == AV_PICTURE_TYPE_P ||
|
||||
@@ -2149,8 +2152,15 @@ static int decode_user_data(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
e = sscanf(buf, "FFmpeg v%d.%d.%d / libavcodec build: %d", &ver, &ver2, &ver3, &build);
|
||||
if (e != 4) {
|
||||
e = sscanf(buf, "Lavc%d.%d.%d", &ver, &ver2, &ver3) + 1;
|
||||
if (e > 1)
|
||||
build = (ver << 16) + (ver2 << 8) + ver3;
|
||||
if (e > 1) {
|
||||
if (ver > 0xFFU || ver2 > 0xFFU || ver3 > 0xFFU) {
|
||||
av_log(s->avctx, AV_LOG_WARNING,
|
||||
"Unknown Lavc version string encountered, %d.%d.%d; "
|
||||
"clamping sub-version values to 8-bits.\n",
|
||||
ver, ver2, ver3);
|
||||
}
|
||||
build = ((ver & 0xFF) << 16) + ((ver2 & 0xFF) << 8) + (ver3 & 0xFF);
|
||||
}
|
||||
}
|
||||
if (e != 4) {
|
||||
if (strcmp(buf, "ffmpeg") == 0)
|
||||
@@ -2660,8 +2670,8 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
|
||||
if (startcode >= 0x120 && startcode <= 0x12F) {
|
||||
if (vol) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Multiple VOL headers");
|
||||
return AVERROR_INVALIDDATA;
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Ignoring multiple VOL headers\n");
|
||||
continue;
|
||||
}
|
||||
vol++;
|
||||
if ((ret = decode_vol_header(ctx, gb)) < 0)
|
||||
|
||||
@@ -20,17 +20,21 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/thread.h"
|
||||
#include "mpegaudiodsp.h"
|
||||
#include "dct.h"
|
||||
#include "dct32.h"
|
||||
|
||||
static AVOnce mpadsp_float_table_init = AV_ONCE_INIT;
|
||||
static AVOnce mpadsp_fixed_table_init = AV_ONCE_INIT;
|
||||
|
||||
av_cold void ff_mpadsp_init(MPADSPContext *s)
|
||||
{
|
||||
DCTContext dct;
|
||||
|
||||
ff_dct_init(&dct, 5, DCT_II);
|
||||
ff_init_mpadsp_tabs_float();
|
||||
ff_init_mpadsp_tabs_fixed();
|
||||
ff_thread_once(&mpadsp_float_table_init, &ff_init_mpadsp_tabs_float);
|
||||
ff_thread_once(&mpadsp_fixed_table_init, &ff_init_mpadsp_tabs_fixed);
|
||||
|
||||
s->apply_window_float = ff_mpadsp_apply_window_float;
|
||||
s->apply_window_fixed = ff_mpadsp_apply_window_fixed;
|
||||
|
||||
+43
-20
@@ -1352,12 +1352,9 @@ av_cold int ff_nvenc_encode_close(AVCodecContext *avctx)
|
||||
av_fifo_freep(&ctx->unused_surface_queue);
|
||||
|
||||
if (ctx->surfaces && avctx->pix_fmt == AV_PIX_FMT_CUDA) {
|
||||
for (i = 0; i < ctx->nb_surfaces; ++i) {
|
||||
if (ctx->surfaces[i].input_surface) {
|
||||
p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, ctx->surfaces[i].in_map.mappedResource);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < ctx->nb_registered_frames; i++) {
|
||||
if (ctx->registered_frames[i].mapped)
|
||||
p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, ctx->registered_frames[i].in_map.mappedResource);
|
||||
if (ctx->registered_frames[i].regptr)
|
||||
p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[i].regptr);
|
||||
}
|
||||
@@ -1485,6 +1482,7 @@ static int nvenc_find_free_reg_resource(AVCodecContext *avctx)
|
||||
NvencContext *ctx = avctx->priv_data;
|
||||
NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
|
||||
NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;
|
||||
NVENCSTATUS nv_status;
|
||||
|
||||
int i;
|
||||
|
||||
@@ -1492,8 +1490,10 @@ static int nvenc_find_free_reg_resource(AVCodecContext *avctx)
|
||||
for (i = 0; i < ctx->nb_registered_frames; i++) {
|
||||
if (!ctx->registered_frames[i].mapped) {
|
||||
if (ctx->registered_frames[i].regptr) {
|
||||
p_nvenc->nvEncUnregisterResource(ctx->nvencoder,
|
||||
ctx->registered_frames[i].regptr);
|
||||
nv_status = p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[i].regptr);
|
||||
if (nv_status != NV_ENC_SUCCESS)
|
||||
return nvenc_print_error(avctx, nv_status, "Failed unregistering unused input resource");
|
||||
ctx->registered_frames[i].ptr = 0;
|
||||
ctx->registered_frames[i].regptr = NULL;
|
||||
}
|
||||
return i;
|
||||
@@ -1572,19 +1572,23 @@ static int nvenc_upload_frame(AVCodecContext *avctx, const AVFrame *frame,
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
nvenc_frame->in_map.version = NV_ENC_MAP_INPUT_RESOURCE_VER;
|
||||
nvenc_frame->in_map.registeredResource = ctx->registered_frames[reg_idx].regptr;
|
||||
nv_status = p_nvenc->nvEncMapInputResource(ctx->nvencoder, &nvenc_frame->in_map);
|
||||
if (nv_status != NV_ENC_SUCCESS) {
|
||||
av_frame_unref(nvenc_frame->in_ref);
|
||||
return nvenc_print_error(avctx, nv_status, "Error mapping an input resource");
|
||||
if (!ctx->registered_frames[reg_idx].mapped) {
|
||||
ctx->registered_frames[reg_idx].in_map.version = NV_ENC_MAP_INPUT_RESOURCE_VER;
|
||||
ctx->registered_frames[reg_idx].in_map.registeredResource = ctx->registered_frames[reg_idx].regptr;
|
||||
nv_status = p_nvenc->nvEncMapInputResource(ctx->nvencoder, &ctx->registered_frames[reg_idx].in_map);
|
||||
if (nv_status != NV_ENC_SUCCESS) {
|
||||
av_frame_unref(nvenc_frame->in_ref);
|
||||
return nvenc_print_error(avctx, nv_status, "Error mapping an input resource");
|
||||
}
|
||||
}
|
||||
|
||||
ctx->registered_frames[reg_idx].mapped = 1;
|
||||
ctx->registered_frames[reg_idx].mapped += 1;
|
||||
|
||||
nvenc_frame->reg_idx = reg_idx;
|
||||
nvenc_frame->input_surface = nvenc_frame->in_map.mappedResource;
|
||||
nvenc_frame->format = nvenc_frame->in_map.mappedBufferFmt;
|
||||
nvenc_frame->input_surface = ctx->registered_frames[reg_idx].in_map.mappedResource;
|
||||
nvenc_frame->format = ctx->registered_frames[reg_idx].in_map.mappedBufferFmt;
|
||||
nvenc_frame->pitch = frame->linesize[0];
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
NV_ENC_LOCK_INPUT_BUFFER lockBufferParams = { 0 };
|
||||
@@ -1729,14 +1733,33 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur
|
||||
memcpy(pkt->data, lock_params.bitstreamBufferPtr, lock_params.bitstreamSizeInBytes);
|
||||
|
||||
nv_status = p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface);
|
||||
if (nv_status != NV_ENC_SUCCESS)
|
||||
nvenc_print_error(avctx, nv_status, "Failed unlocking bitstream buffer, expect the gates of mordor to open");
|
||||
if (nv_status != NV_ENC_SUCCESS) {
|
||||
res = nvenc_print_error(avctx, nv_status, "Failed unlocking bitstream buffer, expect the gates of mordor to open");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
if (avctx->pix_fmt == AV_PIX_FMT_CUDA) {
|
||||
p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, tmpoutsurf->in_map.mappedResource);
|
||||
ctx->registered_frames[tmpoutsurf->reg_idx].mapped -= 1;
|
||||
if (ctx->registered_frames[tmpoutsurf->reg_idx].mapped == 0) {
|
||||
nv_status = p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, ctx->registered_frames[tmpoutsurf->reg_idx].in_map.mappedResource);
|
||||
if (nv_status != NV_ENC_SUCCESS) {
|
||||
res = nvenc_print_error(avctx, nv_status, "Failed unmapping input resource");
|
||||
goto error;
|
||||
}
|
||||
nv_status = p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[tmpoutsurf->reg_idx].regptr);
|
||||
if (nv_status != NV_ENC_SUCCESS) {
|
||||
res = nvenc_print_error(avctx, nv_status, "Failed unregistering input resource");
|
||||
goto error;
|
||||
}
|
||||
ctx->registered_frames[tmpoutsurf->reg_idx].ptr = 0;
|
||||
ctx->registered_frames[tmpoutsurf->reg_idx].regptr = NULL;
|
||||
} else if (ctx->registered_frames[tmpoutsurf->reg_idx].mapped < 0) {
|
||||
res = AVERROR_BUG;
|
||||
goto error;
|
||||
}
|
||||
|
||||
av_frame_unref(tmpoutsurf->in_ref);
|
||||
ctx->registered_frames[tmpoutsurf->reg_idx].mapped = 0;
|
||||
|
||||
tmpoutsurf->input_surface = NULL;
|
||||
}
|
||||
|
||||
+1
-1
@@ -37,7 +37,6 @@ typedef struct NvencSurface
|
||||
{
|
||||
NV_ENC_INPUT_PTR input_surface;
|
||||
AVFrame *in_ref;
|
||||
NV_ENC_MAP_INPUT_RESOURCE in_map;
|
||||
int reg_idx;
|
||||
int width;
|
||||
int height;
|
||||
@@ -122,6 +121,7 @@ typedef struct NvencContext
|
||||
CUdeviceptr ptr;
|
||||
NV_ENC_REGISTERED_PTR regptr;
|
||||
int mapped;
|
||||
NV_ENC_MAP_INPUT_RESOURCE in_map;
|
||||
} registered_frames[MAX_REGISTERED_FRAMES];
|
||||
int nb_registered_frames;
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_le
|
||||
const uint8_t *buf = start + 1;
|
||||
int start_trim_flag, end_trim_flag, control_extension_flag, control_extension_length;
|
||||
uint8_t flags;
|
||||
uint64_t payload_len_tmp;
|
||||
|
||||
GetByteContext gb;
|
||||
bytestream2_init(&gb, buf, buf_len);
|
||||
@@ -52,11 +53,11 @@ static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_le
|
||||
end_trim_flag = (flags >> 3) & 1;
|
||||
control_extension_flag = (flags >> 2) & 1;
|
||||
|
||||
*payload_len = 0;
|
||||
payload_len_tmp = *payload_len = 0;
|
||||
while (bytestream2_peek_byte(&gb) == 0xff)
|
||||
*payload_len += bytestream2_get_byte(&gb);
|
||||
payload_len_tmp += bytestream2_get_byte(&gb);
|
||||
|
||||
*payload_len += bytestream2_get_byte(&gb);
|
||||
payload_len_tmp += bytestream2_get_byte(&gb);
|
||||
|
||||
if (start_trim_flag)
|
||||
bytestream2_skip(&gb, 2);
|
||||
@@ -67,6 +68,11 @@ static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_le
|
||||
bytestream2_skip(&gb, control_extension_length);
|
||||
}
|
||||
|
||||
if (bytestream2_tell(&gb) + payload_len_tmp > buf_len)
|
||||
return NULL;
|
||||
|
||||
*payload_len = payload_len_tmp;
|
||||
|
||||
return buf + bytestream2_tell(&gb);
|
||||
}
|
||||
|
||||
@@ -104,6 +110,10 @@ static int opus_find_frame_end(AVCodecParserContext *ctx, AVCodecContext *avctx,
|
||||
state = (state << 8) | payload[i];
|
||||
if ((state & OPUS_TS_MASK) == OPUS_TS_HEADER) {
|
||||
payload = parse_opus_ts_header(payload, &payload_len, buf_size - i);
|
||||
if (!payload) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error parsing Ogg TS header.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
*header_len = payload - buf;
|
||||
start_found = 1;
|
||||
break;
|
||||
|
||||
@@ -78,6 +78,7 @@ static av_cold int paf_video_init(AVCodecContext *avctx)
|
||||
{
|
||||
PAFVideoDecContext *c = avctx->priv_data;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
c->width = avctx->width;
|
||||
c->height = avctx->height;
|
||||
@@ -90,6 +91,9 @@ static av_cold int paf_video_init(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
ret = av_image_check_size2(avctx->width, FFALIGN(avctx->height, 256), avctx->max_pixels, avctx->pix_fmt, 0, avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
c->pic = av_frame_alloc();
|
||||
if (!c->pic)
|
||||
@@ -181,6 +185,8 @@ static int decode_0(PAFVideoDecContext *c, uint8_t *pkt, uint8_t code)
|
||||
dend = c->frame[page] + c->frame_size;
|
||||
offset = (x & 0x7F) * 2;
|
||||
j = bytestream2_get_le16(&c->gb) + offset;
|
||||
if (bytestream2_get_bytes_left(&c->gb) < (j - offset) * 16)
|
||||
return AVERROR_INVALIDDATA;
|
||||
do {
|
||||
offset++;
|
||||
if (dst + 3 * c->width + 4 > dend)
|
||||
@@ -198,7 +204,8 @@ static int decode_0(PAFVideoDecContext *c, uint8_t *pkt, uint8_t code)
|
||||
do {
|
||||
set_src_position(c, &src, &send);
|
||||
if ((src + 3 * c->width + 4 > send) ||
|
||||
(dst + 3 * c->width + 4 > dend))
|
||||
(dst + 3 * c->width + 4 > dend) ||
|
||||
bytestream2_get_bytes_left(&c->gb) < 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
copy_block4(dst, src, c->width, c->width, 4);
|
||||
i++;
|
||||
|
||||
@@ -517,8 +517,8 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int
|
||||
int luma_stride, chroma_stride;
|
||||
int y_data_size, u_data_size, v_data_size, a_data_size;
|
||||
uint8_t *dest_y, *dest_u, *dest_v, *dest_a;
|
||||
int16_t qmat_luma_scaled[64];
|
||||
int16_t qmat_chroma_scaled[64];
|
||||
LOCAL_ALIGNED_16(int16_t, qmat_luma_scaled, [64]);
|
||||
LOCAL_ALIGNED_16(int16_t, qmat_chroma_scaled,[64]);
|
||||
int mb_x_shift;
|
||||
int ret;
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ static av_always_inline SoftFloat autocorr_calc(int64_t accu)
|
||||
|
||||
round = 1U << (nz-1);
|
||||
mant = (int)((accu + round) >> nz);
|
||||
mant = (mant + 0x40)>>7;
|
||||
mant = (mant + 0x40LL)>>7;
|
||||
mant *= 64;
|
||||
expo = nz + 15;
|
||||
return av_int2sf(mant, 30 - expo);
|
||||
@@ -244,12 +244,14 @@ static void sbr_hf_g_filt_c(int (*Y)[2], const int (*X_high)[40][2],
|
||||
int64_t accu;
|
||||
|
||||
for (m = 0; m < m_max; m++) {
|
||||
int64_t r = 1LL << (22-g_filt[m].exp);
|
||||
accu = (int64_t)X_high[m][ixh][0] * ((g_filt[m].mant + 0x40)>>7);
|
||||
Y[m][0] = (int)((accu + r) >> (23-g_filt[m].exp));
|
||||
if (22 - g_filt[m].exp < 61) {
|
||||
int64_t r = 1LL << (22-g_filt[m].exp);
|
||||
accu = (int64_t)X_high[m][ixh][0] * ((g_filt[m].mant + 0x40)>>7);
|
||||
Y[m][0] = (int)((accu + r) >> (23-g_filt[m].exp));
|
||||
|
||||
accu = (int64_t)X_high[m][ixh][1] * ((g_filt[m].mant + 0x40)>>7);
|
||||
Y[m][1] = (int)((accu + r) >> (23-g_filt[m].exp));
|
||||
accu = (int64_t)X_high[m][ixh][1] * ((g_filt[m].mant + 0x40)>>7);
|
||||
Y[m][1] = (int)((accu + r) >> (23-g_filt[m].exp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -681,6 +681,8 @@ static int decompress_p(AVCodecContext *avctx,
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (bx == 0) {
|
||||
if (by < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
z = backstep;
|
||||
} else {
|
||||
z = 0;
|
||||
@@ -710,6 +712,8 @@ static int decompress_p(AVCodecContext *avctx,
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (bx == 0) {
|
||||
if (by < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
z = backstep;
|
||||
} else {
|
||||
z = 0;
|
||||
|
||||
+25
-12
@@ -183,13 +183,22 @@ static int decode_q_branch(SnowContext *s, int level, int x, int y){
|
||||
int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my));
|
||||
|
||||
type= get_rac(&s->c, &s->block_state[1 + left->type + top->type]) ? BLOCK_INTRA : 0;
|
||||
|
||||
if(type){
|
||||
int ld, cbd, crd;
|
||||
pred_mv(s, &mx, &my, 0, left, top, tr);
|
||||
l += get_symbol(&s->c, &s->block_state[32], 1);
|
||||
ld = get_symbol(&s->c, &s->block_state[32], 1);
|
||||
if (ld < -255 || ld > 255) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
l += ld;
|
||||
if (s->nb_planes > 2) {
|
||||
cb+= get_symbol(&s->c, &s->block_state[64], 1);
|
||||
cr+= get_symbol(&s->c, &s->block_state[96], 1);
|
||||
cbd = get_symbol(&s->c, &s->block_state[64], 1);
|
||||
crd = get_symbol(&s->c, &s->block_state[96], 1);
|
||||
if (cbd < -255 || cbd > 255 || crd < -255 || crd > 255) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
cb += cbd;
|
||||
cr += crd;
|
||||
}
|
||||
}else{
|
||||
if(s->ref_frames > 1)
|
||||
@@ -354,9 +363,10 @@ static int decode_header(SnowContext *s){
|
||||
int htaps, i, sum=0;
|
||||
Plane *p= &s->plane[plane_index];
|
||||
p->diag_mc= get_rac(&s->c, s->header_state);
|
||||
htaps= get_symbol(&s->c, s->header_state, 0)*2 + 2;
|
||||
if((unsigned)htaps >= HTAPS_MAX || htaps==0)
|
||||
htaps= get_symbol(&s->c, s->header_state, 0);
|
||||
if((unsigned)htaps >= HTAPS_MAX/2 - 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
htaps = htaps*2 + 2;
|
||||
p->htaps= htaps;
|
||||
for(i= htaps/2; i; i--){
|
||||
p->hcoeff[i]= get_symbol(&s->c, s->header_state, 0) * (1-2*(i&1));
|
||||
@@ -374,7 +384,7 @@ static int decode_header(SnowContext *s){
|
||||
}
|
||||
}
|
||||
|
||||
s->spatial_decomposition_type+= get_symbol(&s->c, s->header_state, 1);
|
||||
s->spatial_decomposition_type+= (unsigned)get_symbol(&s->c, s->header_state, 1);
|
||||
if(s->spatial_decomposition_type > 1U){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "spatial_decomposition_type %d not supported\n", s->spatial_decomposition_type);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -390,13 +400,14 @@ static int decode_header(SnowContext *s){
|
||||
}
|
||||
|
||||
|
||||
s->qlog += get_symbol(&s->c, s->header_state, 1);
|
||||
s->mv_scale += get_symbol(&s->c, s->header_state, 1);
|
||||
s->qbias += get_symbol(&s->c, s->header_state, 1);
|
||||
s->block_max_depth+= get_symbol(&s->c, s->header_state, 1);
|
||||
if(s->block_max_depth > 1 || s->block_max_depth < 0){
|
||||
s->qlog += (unsigned)get_symbol(&s->c, s->header_state, 1);
|
||||
s->mv_scale += (unsigned)get_symbol(&s->c, s->header_state, 1);
|
||||
s->qbias += (unsigned)get_symbol(&s->c, s->header_state, 1);
|
||||
s->block_max_depth+= (unsigned)get_symbol(&s->c, s->header_state, 1);
|
||||
if(s->block_max_depth > 1 || s->block_max_depth < 0 || s->mv_scale > 256U){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "block_max_depth= %d is too large\n", s->block_max_depth);
|
||||
s->block_max_depth= 0;
|
||||
s->mv_scale = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (FFABS(s->qbias) > 127) {
|
||||
@@ -427,6 +438,8 @@ static int decode_blocks(SnowContext *s){
|
||||
|
||||
for(y=0; y<h; y++){
|
||||
for(x=0; x<w; x++){
|
||||
if (s->c.bytestream >= s->c.bytestream_end)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ((res = decode_q_branch(s, 0, x, y)) < 0)
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -441,8 +441,8 @@ static inline int GET_TOK(TM2Context *ctx,int type)
|
||||
|
||||
/* recalculate last and delta values for next blocks */
|
||||
#define TM2_RECALC_BLOCK(CHR, stride, last, CD) {\
|
||||
CD[0] = CHR[1] - last[1];\
|
||||
CD[1] = (int)CHR[stride + 1] - (int)CHR[1];\
|
||||
CD[0] = (unsigned)CHR[ 1] - (unsigned)last[1];\
|
||||
CD[1] = (unsigned)CHR[stride + 1] - (unsigned) CHR[1];\
|
||||
last[0] = (int)CHR[stride + 0];\
|
||||
last[1] = (int)CHR[stride + 1];}
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ static av_cold int ulti_decode_init(AVCodecContext *avctx)
|
||||
s->width = avctx->width;
|
||||
s->height = avctx->height;
|
||||
s->blocks = (s->width / 8) * (s->height / 8);
|
||||
if (s->blocks == 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV410P;
|
||||
s->ulti_codebook = ulti_codebook;
|
||||
|
||||
|
||||
+2
-2
@@ -655,7 +655,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
avctx->internal = av_mallocz(sizeof(AVCodecInternal));
|
||||
avctx->internal = av_mallocz(sizeof(*avctx->internal));
|
||||
if (!avctx->internal) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto end;
|
||||
@@ -1157,7 +1157,7 @@ void avsubtitle_free(AVSubtitle *sub)
|
||||
|
||||
av_freep(&sub->rects);
|
||||
|
||||
memset(sub, 0, sizeof(AVSubtitle));
|
||||
memset(sub, 0, sizeof(*sub));
|
||||
}
|
||||
|
||||
av_cold int avcodec_close(AVCodecContext *avctx)
|
||||
|
||||
@@ -561,7 +561,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
for (j = 0; j < c->slices; j++) {
|
||||
slice_end = bytestream2_get_le32u(&gb);
|
||||
if (slice_end < 0 || slice_end < slice_start ||
|
||||
bytestream2_get_bytes_left(&gb) < slice_end) {
|
||||
bytestream2_get_bytes_left(&gb) < slice_end + 1024LL) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Incorrect slice size\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
+3
-2
@@ -1171,7 +1171,7 @@ static av_cold int vc2_encode_init(AVCodecContext *avctx)
|
||||
p->dwt_width = w = FFALIGN(p->width, (1 << s->wavelet_depth));
|
||||
p->dwt_height = h = FFALIGN(p->height, (1 << s->wavelet_depth));
|
||||
p->coef_stride = FFALIGN(p->dwt_width, 32);
|
||||
p->coef_buf = av_malloc(p->coef_stride*p->dwt_height*sizeof(dwtcoef));
|
||||
p->coef_buf = av_mallocz(p->coef_stride*p->dwt_height*sizeof(dwtcoef));
|
||||
if (!p->coef_buf)
|
||||
goto alloc_fail;
|
||||
for (level = s->wavelet_depth-1; level >= 0; level--) {
|
||||
@@ -1190,7 +1190,8 @@ static av_cold int vc2_encode_init(AVCodecContext *avctx)
|
||||
/* DWT init */
|
||||
if (ff_vc2enc_init_transforms(&s->transform_args[i].t,
|
||||
s->plane[i].coef_stride,
|
||||
s->plane[i].dwt_height))
|
||||
s->plane[i].dwt_height,
|
||||
s->slice_width, s->slice_height))
|
||||
goto alloc_fail;
|
||||
}
|
||||
|
||||
|
||||
@@ -255,21 +255,27 @@ static void vc2_subband_dwt_haar_shift(VC2TransformContext *t, dwtcoef *data,
|
||||
dwt_haar(t, data, stride, width, height, 1);
|
||||
}
|
||||
|
||||
av_cold int ff_vc2enc_init_transforms(VC2TransformContext *s, int p_width, int p_height)
|
||||
av_cold int ff_vc2enc_init_transforms(VC2TransformContext *s, int p_stride,
|
||||
int p_height, int slice_w, int slice_h)
|
||||
{
|
||||
s->vc2_subband_dwt[VC2_TRANSFORM_9_7] = vc2_subband_dwt_97;
|
||||
s->vc2_subband_dwt[VC2_TRANSFORM_5_3] = vc2_subband_dwt_53;
|
||||
s->vc2_subband_dwt[VC2_TRANSFORM_HAAR] = vc2_subband_dwt_haar;
|
||||
s->vc2_subband_dwt[VC2_TRANSFORM_HAAR_S] = vc2_subband_dwt_haar_shift;
|
||||
|
||||
s->buffer = av_malloc(2*p_width*p_height*sizeof(dwtcoef));
|
||||
/* Pad by the slice size, only matters for non-Haar wavelets */
|
||||
s->buffer = av_calloc((p_stride + slice_w)*(p_height + slice_h), sizeof(dwtcoef));
|
||||
if (!s->buffer)
|
||||
return 1;
|
||||
|
||||
s->padding = (slice_h >> 1)*p_stride + (slice_w >> 1);
|
||||
s->buffer += s->padding;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
av_cold void ff_vc2enc_free_transforms(VC2TransformContext *s)
|
||||
{
|
||||
av_freep(&s->buffer);
|
||||
av_free(s->buffer - s->padding);
|
||||
s->buffer = NULL;
|
||||
}
|
||||
|
||||
@@ -41,12 +41,14 @@ enum VC2TransformType {
|
||||
|
||||
typedef struct VC2TransformContext {
|
||||
dwtcoef *buffer;
|
||||
int padding;
|
||||
void (*vc2_subband_dwt[VC2_TRANSFORMS_NB])(struct VC2TransformContext *t,
|
||||
dwtcoef *data, ptrdiff_t stride,
|
||||
int width, int height);
|
||||
} VC2TransformContext;
|
||||
|
||||
int ff_vc2enc_init_transforms(VC2TransformContext *t, int p_width, int p_height);
|
||||
int ff_vc2enc_init_transforms(VC2TransformContext *t, int p_stride, int p_height,
|
||||
int slice_w, int slice_h);
|
||||
void ff_vc2enc_free_transforms(VC2TransformContext *t);
|
||||
|
||||
#endif /* AVCODEC_VC2ENC_DWT_H */
|
||||
|
||||
+1
-1
@@ -816,7 +816,7 @@ do { \
|
||||
|
||||
AVVDPAUContext *av_vdpau_alloc_context(void)
|
||||
{
|
||||
return av_mallocz(sizeof(AVVDPAUContext));
|
||||
return av_mallocz(sizeof(VDPAUHWContext));
|
||||
}
|
||||
|
||||
int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
|
||||
|
||||
+2
-2
@@ -67,7 +67,7 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
|
||||
if (bits[p] > 32)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (i = 0; i < bits[p]; ++i)
|
||||
exit_at_level[i+1] = 1 << i;
|
||||
exit_at_level[i+1] = 1u << i;
|
||||
|
||||
++p;
|
||||
|
||||
@@ -91,7 +91,7 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
|
||||
exit_at_level[i] = 0;
|
||||
// construct code (append 0s to end) and introduce new exits
|
||||
for (j = i + 1 ;j <= bits[p]; ++j)
|
||||
exit_at_level[j] = code + (1 << (j - 1));
|
||||
exit_at_level[j] = code + (1u << (j - 1));
|
||||
codes[p] = code;
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -951,9 +951,11 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
|
||||
Vp3Fragment *all_fragments = s->all_fragments;
|
||||
VLC_TYPE(*vlc_table)[2] = table->table;
|
||||
|
||||
if (num_coeffs < 0)
|
||||
if (num_coeffs < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Invalid number of coefficients at level %d\n", coeff_index);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (eob_run > num_coeffs) {
|
||||
coeff_i =
|
||||
@@ -978,6 +980,9 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
|
||||
if (eob_run_get_bits[token])
|
||||
eob_run += get_bits(gb, eob_run_get_bits[token]);
|
||||
|
||||
if (!eob_run)
|
||||
eob_run = INT_MAX;
|
||||
|
||||
// record only the number of blocks ended in this plane,
|
||||
// any spill will be recorded in the next plane.
|
||||
if (eob_run > num_coeffs - coeff_i) {
|
||||
|
||||
+3
-1
@@ -1634,8 +1634,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
{
|
||||
ret = decode_tiles(avctx, data, size);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
ff_thread_report_progress(&s->s.frames[CUR_FRAME].tf, INT_MAX, 0);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
// Sum all counts fields into td[0].counts for tile threading
|
||||
|
||||
@@ -59,7 +59,7 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
|
||||
|
||||
if (in->size >= idx_size && in->data[in->size - idx_size] == marker) {
|
||||
GetByteContext bc;
|
||||
int total_size = 0;
|
||||
int64_t total_size = 0;
|
||||
|
||||
bytestream2_init(&bc, in->data + in->size + 1 - idx_size,
|
||||
nb_frames * length_size);
|
||||
@@ -70,7 +70,7 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
|
||||
frame_size |= bytestream2_get_byte(&bc) << (j * 8);
|
||||
|
||||
total_size += frame_size;
|
||||
if (total_size > in->size - idx_size) {
|
||||
if (frame_size < 0 || total_size > in->size - idx_size) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"Invalid frame size in a superframe: %d\n", frame_size);
|
||||
ret = AVERROR(EINVAL);
|
||||
|
||||
@@ -433,8 +433,8 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
|
||||
L2 = L + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10);
|
||||
R2 = R + ((s->decorr[i].weightB * (int64_t)B + 512) >> 10);
|
||||
} else {
|
||||
L2 = L + ((int)(s->decorr[i].weightA * (unsigned)A + 512) >> 10);
|
||||
R2 = R + ((int)(s->decorr[i].weightB * (unsigned)B + 512) >> 10);
|
||||
L2 = L + (unsigned)((int)(s->decorr[i].weightA * (unsigned)A + 512) >> 10);
|
||||
R2 = R + (unsigned)((int)(s->decorr[i].weightB * (unsigned)B + 512) >> 10);
|
||||
}
|
||||
if (A && L)
|
||||
s->decorr[i].weightA -= ((((L ^ A) >> 30) & 2) - 1) * s->decorr[i].delta;
|
||||
@@ -446,7 +446,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
|
||||
if (type != AV_SAMPLE_FMT_S16P)
|
||||
L2 = L + ((s->decorr[i].weightA * (int64_t)s->decorr[i].samplesA[0] + 512) >> 10);
|
||||
else
|
||||
L2 = L + ((int)(s->decorr[i].weightA * (unsigned)s->decorr[i].samplesA[0] + 512) >> 10);
|
||||
L2 = L + (unsigned)((int)(s->decorr[i].weightA * (unsigned)s->decorr[i].samplesA[0] + 512) >> 10);
|
||||
UPDATE_WEIGHT_CLIP(s->decorr[i].weightA, s->decorr[i].delta, s->decorr[i].samplesA[0], L);
|
||||
L = L2;
|
||||
if (type != AV_SAMPLE_FMT_S16P)
|
||||
@@ -460,7 +460,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
|
||||
if (type != AV_SAMPLE_FMT_S16P)
|
||||
R2 = R + ((s->decorr[i].weightB * (int64_t)s->decorr[i].samplesB[0] + 512) >> 10);
|
||||
else
|
||||
R2 = R + ((int)(s->decorr[i].weightB * (unsigned)s->decorr[i].samplesB[0] + 512) >> 10);
|
||||
R2 = R + (unsigned)((int)(s->decorr[i].weightB * (unsigned)s->decorr[i].samplesB[0] + 512) >> 10);
|
||||
UPDATE_WEIGHT_CLIP(s->decorr[i].weightB, s->decorr[i].delta, s->decorr[i].samplesB[0], R);
|
||||
R = R2;
|
||||
|
||||
@@ -472,7 +472,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
|
||||
if (type != AV_SAMPLE_FMT_S16P)
|
||||
L2 = L + ((s->decorr[i].weightA * (int64_t)R2 + 512) >> 10);
|
||||
else
|
||||
L2 = L + ((int)(s->decorr[i].weightA * (unsigned)R2 + 512) >> 10);
|
||||
L2 = L + (unsigned)((int)(s->decorr[i].weightA * (unsigned)R2 + 512) >> 10);
|
||||
UPDATE_WEIGHT_CLIP(s->decorr[i].weightA, s->decorr[i].delta, R2, L);
|
||||
L = L2;
|
||||
s->decorr[i].samplesB[0] = L;
|
||||
@@ -480,7 +480,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
|
||||
}
|
||||
|
||||
if (type == AV_SAMPLE_FMT_S16P) {
|
||||
if (FFABS(L) + (unsigned)FFABS(R) > (1<<19)) {
|
||||
if (FFABS((int64_t)L) + FFABS((int64_t)R) > (1<<19)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "sample %d %d too large\n", L, R);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -554,7 +554,7 @@ static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb,
|
||||
if (type != AV_SAMPLE_FMT_S16P)
|
||||
S = T + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10);
|
||||
else
|
||||
S = T + ((int)(s->decorr[i].weightA * (unsigned)A + 512) >> 10);
|
||||
S = T + (unsigned)((int)(s->decorr[i].weightA * (unsigned)A + 512) >> 10);
|
||||
if (A && T)
|
||||
s->decorr[i].weightA -= ((((T ^ A) >> 30) & 2) - 1) * s->decorr[i].delta;
|
||||
s->decorr[i].samplesA[j] = T = S;
|
||||
|
||||
+16
-2
@@ -30,7 +30,7 @@
|
||||
#include "wmv2.h"
|
||||
|
||||
|
||||
static void parse_mb_skip(Wmv2Context *w)
|
||||
static int parse_mb_skip(Wmv2Context *w)
|
||||
{
|
||||
int mb_x, mb_y;
|
||||
MpegEncContext *const s = &w->s;
|
||||
@@ -45,6 +45,8 @@ static void parse_mb_skip(Wmv2Context *w)
|
||||
MB_TYPE_16x16 | MB_TYPE_L0;
|
||||
break;
|
||||
case SKIP_TYPE_MPEG:
|
||||
if (get_bits_left(&s->gb) < s->mb_height * s->mb_width)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++)
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++)
|
||||
mb_type[mb_y * s->mb_stride + mb_x] =
|
||||
@@ -52,6 +54,8 @@ static void parse_mb_skip(Wmv2Context *w)
|
||||
break;
|
||||
case SKIP_TYPE_ROW:
|
||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
||||
if (get_bits_left(&s->gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (get_bits1(&s->gb)) {
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++)
|
||||
mb_type[mb_y * s->mb_stride + mb_x] =
|
||||
@@ -65,6 +69,8 @@ static void parse_mb_skip(Wmv2Context *w)
|
||||
break;
|
||||
case SKIP_TYPE_COL:
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
||||
if (get_bits_left(&s->gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (get_bits1(&s->gb)) {
|
||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++)
|
||||
mb_type[mb_y * s->mb_stride + mb_x] =
|
||||
@@ -77,6 +83,7 @@ static void parse_mb_skip(Wmv2Context *w)
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_ext_header(Wmv2Context *w)
|
||||
@@ -170,9 +177,12 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
|
||||
}
|
||||
} else {
|
||||
int cbp_index;
|
||||
int ret;
|
||||
w->j_type = 0;
|
||||
|
||||
parse_mb_skip(w);
|
||||
ret = parse_mb_skip(w);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
cbp_index = decode012(&s->gb);
|
||||
w->cbp_table_index = wmv2_get_cbp_table_index(s, cbp_index);
|
||||
|
||||
@@ -359,6 +369,8 @@ int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
w->hshift = 0;
|
||||
return 0;
|
||||
}
|
||||
if (get_bits_left(&s->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table,
|
||||
MB_NON_INTRA_VLC_BITS, 3);
|
||||
@@ -369,6 +381,8 @@ int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
cbp = code & 0x3f;
|
||||
} else {
|
||||
s->mb_intra = 1;
|
||||
if (get_bits_left(&s->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
|
||||
if (code < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
|
||||
@@ -52,8 +52,9 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src,
|
||||
const int dyh = (dyy - (1 << (16 + shift))) * (h - 1);
|
||||
const int dxh = dxy * (h - 1);
|
||||
const int dyw = dyx * (w - 1);
|
||||
int need_emu = (unsigned) ix >= width - w ||
|
||||
(unsigned) iy >= height - h;
|
||||
int need_emu = (unsigned) ix >= width - w || width < w ||
|
||||
(unsigned) iy >= height - h || height< h
|
||||
;
|
||||
|
||||
if ( // non-constant fullpel offset (3% of blocks)
|
||||
((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) |
|
||||
|
||||
+5
-2
@@ -131,7 +131,10 @@ static int xan_huffman_decode(uint8_t *dest, int dest_len,
|
||||
return ret;
|
||||
|
||||
while (val != 0x16) {
|
||||
unsigned idx = val - 0x17 + get_bits1(&gb) * byte;
|
||||
unsigned idx;
|
||||
if (get_bits_left(&gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
idx = val - 0x17 + get_bits1(&gb) * byte;
|
||||
if (idx >= 2 * byte)
|
||||
return AVERROR_INVALIDDATA;
|
||||
val = src[idx];
|
||||
@@ -263,7 +266,7 @@ static inline void xan_wc3_copy_pixel_run(XanContext *s, AVFrame *frame,
|
||||
prevframe_index = (y + motion_y) * stride + x + motion_x;
|
||||
prevframe_x = x + motion_x;
|
||||
|
||||
if (prev_palette_plane == palette_plane && FFABS(curframe_index - prevframe_index) < pixel_count) {
|
||||
if (prev_palette_plane == palette_plane && FFABS(motion_x + width*motion_y) < pixel_count) {
|
||||
avpriv_request_sample(s->avctx, "Overlapping copy");
|
||||
return ;
|
||||
}
|
||||
|
||||
@@ -539,6 +539,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
} else {
|
||||
frame->key_frame = 0;
|
||||
frame->pict_type = AV_PICTURE_TYPE_P;
|
||||
if (c->decomp_len < 2LL * ((c->width + c->bw - 1) / c->bw) * ((c->height + c->bh - 1) / c->bh))
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (c->decomp_len)
|
||||
c->decode_xor(c);
|
||||
}
|
||||
|
||||
+10
-10
@@ -28,7 +28,7 @@
|
||||
typedef struct DCShiftContext {
|
||||
const AVClass *class;
|
||||
double dcshift;
|
||||
double limiterthreshhold;
|
||||
double limiterthreshold;
|
||||
double limitergain;
|
||||
} DCShiftContext;
|
||||
|
||||
@@ -47,7 +47,7 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
{
|
||||
DCShiftContext *s = ctx->priv;
|
||||
|
||||
s->limiterthreshhold = INT32_MAX * (1.0 - (fabs(s->dcshift) - s->limitergain));
|
||||
s->limiterthreshold = INT32_MAX * (1.0 - (fabs(s->dcshift) - s->limitergain));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -111,14 +111,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
|
||||
d = src[j];
|
||||
|
||||
if (d > s->limiterthreshhold && dcshift > 0) {
|
||||
d = (d - s->limiterthreshhold) * s->limitergain /
|
||||
(INT32_MAX - s->limiterthreshhold) +
|
||||
s->limiterthreshhold + dcshift;
|
||||
} else if (d < -s->limiterthreshhold && dcshift < 0) {
|
||||
d = (d + s->limiterthreshhold) * s->limitergain /
|
||||
(INT32_MAX - s->limiterthreshhold) -
|
||||
s->limiterthreshhold + dcshift;
|
||||
if (d > s->limiterthreshold && dcshift > 0) {
|
||||
d = (d - s->limiterthreshold) * s->limitergain /
|
||||
(INT32_MAX - s->limiterthreshold) +
|
||||
s->limiterthreshold + dcshift;
|
||||
} else if (d < -s->limiterthreshold && dcshift < 0) {
|
||||
d = (d + s->limiterthreshold) * s->limitergain /
|
||||
(INT32_MAX - s->limiterthreshold) -
|
||||
s->limiterthreshold + dcshift;
|
||||
} else {
|
||||
d = dcshift * INT32_MAX + d;
|
||||
}
|
||||
|
||||
@@ -166,6 +166,7 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
goto fail;
|
||||
}
|
||||
/* gains */
|
||||
sign = 1;
|
||||
while (1) {
|
||||
gain = 1;
|
||||
if (sscanf(arg, "%lf%n *%n", &gain, &len, &len))
|
||||
|
||||
@@ -72,7 +72,7 @@ do {
|
||||
for (j = 0; j < b->nb; j++) \
|
||||
if (a->fmts[i] == b->fmts[j]) { \
|
||||
if(k >= FFMIN(a->nb, b->nb)){ \
|
||||
av_log(NULL, AV_LOG_ERROR, "Duplicate formats in avfilter_merge_formats() detected\n"); \
|
||||
av_log(NULL, AV_LOG_ERROR, "Duplicate formats in %s detected\n", __FUNCTION__); \
|
||||
av_free(ret->fmts); \
|
||||
av_free(ret); \
|
||||
return NULL; \
|
||||
|
||||
@@ -615,22 +615,22 @@ static const AVOption deint_vaapi_options[] = {
|
||||
OFFSET(mode), AV_OPT_TYPE_INT, { .i64 = VAProcDeinterlacingNone },
|
||||
VAProcDeinterlacingNone, VAProcDeinterlacingCount - 1, FLAGS, "mode" },
|
||||
{ "default", "Use the highest-numbered (and therefore possibly most advanced) deinterlacing algorithm",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingNone }, .unit = "mode" },
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingNone }, 0, 0, FLAGS, "mode" },
|
||||
{ "bob", "Use the bob deinterlacing algorithm",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingBob }, .unit = "mode" },
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingBob }, 0, 0, FLAGS, "mode" },
|
||||
{ "weave", "Use the weave deinterlacing algorithm",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingWeave }, .unit = "mode" },
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingWeave }, 0, 0, FLAGS, "mode" },
|
||||
{ "motion_adaptive", "Use the motion adaptive deinterlacing algorithm",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionAdaptive }, .unit = "mode" },
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionAdaptive }, 0, 0, FLAGS, "mode" },
|
||||
{ "motion_compensated", "Use the motion compensated deinterlacing algorithm",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionCompensated }, .unit = "mode" },
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionCompensated }, 0, 0, FLAGS, "mode" },
|
||||
|
||||
{ "rate", "Generate output at frame rate or field rate",
|
||||
OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 2, FLAGS, "rate" },
|
||||
{ "frame", "Output at frame rate (one frame of output for each field-pair)",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = 1 }, .unit = "rate" },
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "rate" },
|
||||
{ "field", "Output at field rate (one frame of output for each field)",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = 2 }, .unit = "rate" },
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, FLAGS, "rate" },
|
||||
|
||||
{ "auto", "Only deinterlace fields, passing frames through unchanged",
|
||||
OFFSET(auto_enable), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS },
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/internal.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
@@ -54,6 +55,7 @@ enum TransposeDir {
|
||||
typedef struct TransContext {
|
||||
const AVClass *class;
|
||||
int hsub, vsub;
|
||||
int planes;
|
||||
int pixsteps[4];
|
||||
|
||||
int passthrough; ///< PassthroughType, landscape passthrough mode enabled
|
||||
@@ -215,6 +217,10 @@ static int config_props_output(AVFilterLink *outlink)
|
||||
|
||||
s->hsub = desc_in->log2_chroma_w;
|
||||
s->vsub = desc_in->log2_chroma_h;
|
||||
s->planes = av_pix_fmt_count_planes(outlink->format);
|
||||
|
||||
av_assert0(desc_in->nb_components == desc_out->nb_components);
|
||||
|
||||
|
||||
av_image_fill_max_pixsteps(s->pixsteps, NULL, desc_out);
|
||||
|
||||
@@ -272,7 +278,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr,
|
||||
AVFrame *in = td->in;
|
||||
int plane;
|
||||
|
||||
for (plane = 0; out->data[plane]; plane++) {
|
||||
for (plane = 0; plane < s->planes; plane++) {
|
||||
int hsub = plane == 1 || plane == 2 ? s->hsub : 0;
|
||||
int vsub = plane == 1 || plane == 2 ? s->vsub : 0;
|
||||
int pixstep = s->pixsteps[plane];
|
||||
|
||||
@@ -139,7 +139,11 @@ static int adts_aac_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
return av_append_packet(s->pb, pkt, fsize - ADTS_HEADER_SIZE);
|
||||
ret = av_append_packet(s->pb, pkt, fsize - ADTS_HEADER_SIZE);
|
||||
if (ret < 0)
|
||||
av_packet_unref(pkt);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
AVInputFormat ff_aac_demuxer = {
|
||||
|
||||
+66
-37
@@ -108,6 +108,9 @@ typedef struct HLSContext {
|
||||
uint32_t start_sequence_source_type; // enum StartSequenceSourceType
|
||||
AVOutputFormat *oformat;
|
||||
AVOutputFormat *vtt_oformat;
|
||||
AVIOContext *out;
|
||||
int packets_written;
|
||||
int init_range_length;
|
||||
|
||||
AVFormatContext *avf;
|
||||
AVFormatContext *vtt_avf;
|
||||
@@ -598,6 +601,7 @@ static int hls_mux_init(AVFormatContext *s)
|
||||
st->time_base = s->streams[i]->time_base;
|
||||
av_dict_copy(&st->metadata, s->streams[i]->metadata, 0);
|
||||
}
|
||||
hls->packets_written = 1;
|
||||
hls->start_pos = 0;
|
||||
hls->new_start = 1;
|
||||
hls->fmp4_init_mode = 0;
|
||||
@@ -607,9 +611,14 @@ static int hls_mux_init(AVFormatContext *s)
|
||||
av_log(s, AV_LOG_WARNING, "Multi-file byterange mode is currently unsupported in the HLS muxer.\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
hls->packets_written = 0;
|
||||
hls->init_range_length = 0;
|
||||
hls->fmp4_init_mode = !byterange_mode;
|
||||
set_http_options(s, &options, hls);
|
||||
if ((ret = s->io_open(s, &oc->pb, hls->base_output_dirname, AVIO_FLAG_WRITE, &options)) < 0) {
|
||||
if ((ret = avio_open_dyn_buf(&oc->pb)) < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = s->io_open(s, &hls->out, hls->base_output_dirname, AVIO_FLAG_WRITE, &options)) < 0) {
|
||||
av_log(s, AV_LOG_ERROR, "Failed to open segment '%s'\n", hls->fmp4_init_filename);
|
||||
return ret;
|
||||
}
|
||||
@@ -634,6 +643,7 @@ static int hls_mux_init(AVFormatContext *s)
|
||||
av_dict_free(&options);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
avio_flush(oc->pb);
|
||||
av_dict_free(&options);
|
||||
}
|
||||
return 0;
|
||||
@@ -1080,15 +1090,15 @@ static int hls_window(AVFormatContext *s, int last)
|
||||
avio_printf(out, ",BYTERANGE=\"%"PRId64"@%"PRId64"\"", en->size, en->pos);
|
||||
}
|
||||
avio_printf(out, "\n");
|
||||
} else {
|
||||
if (hls->flags & HLS_ROUND_DURATIONS)
|
||||
avio_printf(out, "#EXTINF:%ld,\n", lrint(en->duration));
|
||||
else
|
||||
avio_printf(out, "#EXTINF:%f,\n", en->duration);
|
||||
if (byterange_mode)
|
||||
avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n",
|
||||
en->size, en->pos);
|
||||
}
|
||||
if (hls->flags & HLS_ROUND_DURATIONS)
|
||||
avio_printf(out, "#EXTINF:%ld,\n", lrint(en->duration));
|
||||
else
|
||||
avio_printf(out, "#EXTINF:%f,\n", en->duration);
|
||||
if (byterange_mode)
|
||||
avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n",
|
||||
en->size, en->pos);
|
||||
|
||||
if (hls->flags & HLS_PROGRAM_DATE_TIME) {
|
||||
time_t tt, wrongsecs;
|
||||
int milli;
|
||||
@@ -1113,11 +1123,9 @@ static int hls_window(AVFormatContext *s, int last)
|
||||
avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, milli, buf1);
|
||||
prog_date_time += en->duration;
|
||||
}
|
||||
if (!((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == hls->segments))) {
|
||||
if (hls->baseurl)
|
||||
avio_printf(out, "%s", hls->baseurl);
|
||||
avio_printf(out, "%s\n", en->filename);
|
||||
}
|
||||
if (hls->baseurl)
|
||||
avio_printf(out, "%s", hls->baseurl);
|
||||
avio_printf(out, "%s\n", en->filename);
|
||||
}
|
||||
|
||||
if (last && (hls->flags & HLS_OMIT_ENDLIST)==0)
|
||||
@@ -1335,6 +1343,7 @@ static int hls_write_header(AVFormatContext *s)
|
||||
AVDictionary *options = NULL;
|
||||
int basename_size = 0;
|
||||
int vtt_basename_size = 0;
|
||||
int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
|
||||
|
||||
if (hls->segment_type == SEGMENT_TYPE_FMP4) {
|
||||
pattern = "%d.m4s";
|
||||
@@ -1444,28 +1453,35 @@ static int hls_write_header(AVFormatContext *s)
|
||||
}
|
||||
}
|
||||
|
||||
if (av_strcasecmp(hls->fmp4_init_filename, "init.mp4")) {
|
||||
int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
|
||||
hls->base_output_dirname = av_malloc(fmp4_init_filename_len);
|
||||
if (!hls->base_output_dirname) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
av_strlcpy(hls->base_output_dirname, hls->fmp4_init_filename, fmp4_init_filename_len);
|
||||
} else {
|
||||
hls->base_output_dirname = av_malloc(basename_size);
|
||||
if (!hls->base_output_dirname) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
av_strlcpy(hls->base_output_dirname, s->filename, basename_size);
|
||||
p = strrchr(hls->base_output_dirname, '/');
|
||||
if (p) {
|
||||
*(p + 1) = '\0';
|
||||
av_strlcat(hls->base_output_dirname, hls->fmp4_init_filename, basename_size);
|
||||
if (hls->segment_type == SEGMENT_TYPE_FMP4) {
|
||||
if (av_strcasecmp(hls->fmp4_init_filename, "init.mp4")) {
|
||||
hls->base_output_dirname = av_malloc(fmp4_init_filename_len);
|
||||
if (!hls->base_output_dirname) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
av_strlcpy(hls->base_output_dirname, hls->fmp4_init_filename, fmp4_init_filename_len);
|
||||
} else {
|
||||
av_strlcpy(hls->base_output_dirname, hls->fmp4_init_filename, basename_size);
|
||||
if (basename_size > 0) {
|
||||
hls->base_output_dirname = av_malloc(basename_size);
|
||||
} else {
|
||||
hls->base_output_dirname = av_malloc(strlen(hls->fmp4_init_filename) + 1);
|
||||
}
|
||||
if (!hls->base_output_dirname) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (basename_size > 0) {
|
||||
av_strlcpy(hls->base_output_dirname, s->filename, basename_size);
|
||||
p = strrchr(hls->base_output_dirname, '/');
|
||||
}
|
||||
if (p) {
|
||||
*(p + 1) = '\0';
|
||||
av_strlcat(hls->base_output_dirname, hls->fmp4_init_filename, basename_size);
|
||||
} else {
|
||||
av_strlcpy(hls->base_output_dirname, hls->fmp4_init_filename, fmp4_init_filename_len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1594,6 +1610,8 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
int is_ref_pkt = 1;
|
||||
int ret = 0, can_split = 1;
|
||||
int stream_index = 0;
|
||||
int range_length = 0;
|
||||
uint8_t *buffer = NULL;
|
||||
|
||||
if (hls->sequence - hls->nb_entries > hls->start_sequence && hls->init_time > 0) {
|
||||
/* reset end_pts, hls->recording_time at end of the init hls list */
|
||||
@@ -1639,7 +1657,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
|
||||
}
|
||||
if (hls->fmp4_init_mode || can_split && av_compare_ts(pkt->pts - hls->start_pts, st->time_base,
|
||||
if (hls->packets_written && can_split && av_compare_ts(pkt->pts - hls->start_pts, st->time_base,
|
||||
end_pts, AV_TIME_BASE_Q) >= 0) {
|
||||
int64_t new_start_pos;
|
||||
char *old_filename = av_strdup(hls->avf->filename);
|
||||
@@ -1655,7 +1673,17 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
hls->size = new_start_pos - hls->start_pos;
|
||||
|
||||
if (!byterange_mode) {
|
||||
ff_format_io_close(s, &oc->pb);
|
||||
if (hls->segment_type == SEGMENT_TYPE_FMP4 && !hls->init_range_length) {
|
||||
avio_flush(oc->pb);
|
||||
range_length = avio_close_dyn_buf(oc->pb, &buffer);
|
||||
avio_write(hls->out, buffer, range_length);
|
||||
hls->init_range_length = range_length;
|
||||
avio_open_dyn_buf(&oc->pb);
|
||||
hls->packets_written = 0;
|
||||
ff_format_io_close(s, &hls->out);
|
||||
} else {
|
||||
ff_format_io_close(s, &oc->pb);
|
||||
}
|
||||
if (hls->vtt_avf) {
|
||||
ff_format_io_close(s, &hls->vtt_avf->pb);
|
||||
}
|
||||
@@ -1713,6 +1741,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
}
|
||||
|
||||
hls->packets_written++;
|
||||
ret = ff_write_chained(oc, stream_index, pkt, s, 0);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -212,6 +212,7 @@ static int lrc_read_header(AVFormatContext *s)
|
||||
}
|
||||
ff_subtitles_queue_finalize(s, &lrc->q);
|
||||
ff_metadata_conv_ctx(s, NULL, ff_lrc_metadata_conv);
|
||||
av_bprint_finalize(&line, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2089,8 +2089,16 @@ static int matroska_parse_tracks(AVFormatContext *s)
|
||||
}
|
||||
|
||||
if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
|
||||
if (!track->default_duration && track->video.frame_rate > 0)
|
||||
track->default_duration = 1000000000 / track->video.frame_rate;
|
||||
if (!track->default_duration && track->video.frame_rate > 0) {
|
||||
double default_duration = 1000000000 / track->video.frame_rate;
|
||||
if (default_duration > UINT64_MAX || default_duration < 0) {
|
||||
av_log(matroska->ctx, AV_LOG_WARNING,
|
||||
"Invalid frame rate %e. Cannot calculate default duration.\n",
|
||||
track->video.frame_rate);
|
||||
} else {
|
||||
track->default_duration = default_duration;
|
||||
}
|
||||
}
|
||||
if (track->video.display_width == -1)
|
||||
track->video.display_width = track->video.pixel_width;
|
||||
if (track->video.display_height == -1)
|
||||
|
||||
@@ -1858,6 +1858,13 @@ static int mkv_write_header(AVFormatContext *s)
|
||||
av_dict_get(s->metadata, "alpha_mode", NULL, 0))
|
||||
version = 4;
|
||||
|
||||
if (s->nb_streams > MAX_TRACKS) {
|
||||
av_log(s, AV_LOG_ERROR,
|
||||
"At most %d streams are supported for muxing in Matroska\n",
|
||||
MAX_TRACKS);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
for (i = 0; i < s->nb_streams; i++) {
|
||||
if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_ATRAC3 ||
|
||||
s->streams[i]->codecpar->codec_id == AV_CODEC_ID_COOK ||
|
||||
@@ -1975,6 +1982,10 @@ static int mkv_write_header(AVFormatContext *s)
|
||||
// initialize stream_duration fields
|
||||
mkv->stream_durations = av_mallocz(s->nb_streams * sizeof(int64_t));
|
||||
mkv->stream_duration_offsets = av_mallocz(s->nb_streams * sizeof(int64_t));
|
||||
if (!mkv->stream_durations || !mkv->stream_duration_offsets) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = mkv_write_tracks(s);
|
||||
if (ret < 0)
|
||||
|
||||
+35
-6
@@ -2422,6 +2422,8 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
avio_rb24(pb); /* flags */
|
||||
|
||||
entries = avio_rb32(pb);
|
||||
if ((uint64_t)entries * 12 + 4 > atom.size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
av_log(c->fc, AV_LOG_TRACE, "track[%u].stsc.entries = %u\n", c->fc->nb_streams - 1, entries);
|
||||
|
||||
@@ -2714,7 +2716,7 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
{
|
||||
AVStream *st;
|
||||
MOVStreamContext *sc;
|
||||
unsigned int i, j, entries, ctts_count = 0;
|
||||
unsigned int i, entries, ctts_count = 0;
|
||||
|
||||
if (c->fc->nb_streams < 1)
|
||||
return 0;
|
||||
@@ -2747,9 +2749,8 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Expand entries such that we have a 1-1 mapping with samples. */
|
||||
for (j = 0; j < count; j++)
|
||||
add_ctts_entry(&sc->ctts_data, &ctts_count, &sc->ctts_allocated_size, 1, duration);
|
||||
add_ctts_entry(&sc->ctts_data, &ctts_count, &sc->ctts_allocated_size,
|
||||
count, duration);
|
||||
|
||||
av_log(c->fc, AV_LOG_TRACE, "count=%d, duration=%d\n",
|
||||
count, duration);
|
||||
@@ -3327,6 +3328,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
|
||||
// Free the old index and the old CTTS structures
|
||||
av_free(e_old);
|
||||
av_free(ctts_data_old);
|
||||
av_freep(&frame_duration_buffer);
|
||||
|
||||
// Null terminate the index ranges array
|
||||
current_index_range++;
|
||||
@@ -3346,6 +3348,8 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
|
||||
unsigned int stps_index = 0;
|
||||
unsigned int i, j;
|
||||
uint64_t stream_size = 0;
|
||||
MOVStts *ctts_data_old = sc->ctts_data;
|
||||
unsigned int ctts_count_old = sc->ctts_count;
|
||||
|
||||
if (sc->elst_count) {
|
||||
int i, edit_start_index = 0, multiple_edits = 0;
|
||||
@@ -3414,6 +3418,28 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
|
||||
}
|
||||
st->index_entries_allocated_size = (st->nb_index_entries + sc->sample_count) * sizeof(*st->index_entries);
|
||||
|
||||
if (ctts_data_old) {
|
||||
// Expand ctts entries such that we have a 1-1 mapping with samples
|
||||
if (sc->sample_count >= UINT_MAX / sizeof(*sc->ctts_data))
|
||||
return;
|
||||
sc->ctts_count = 0;
|
||||
sc->ctts_allocated_size = 0;
|
||||
sc->ctts_data = av_fast_realloc(NULL, &sc->ctts_allocated_size,
|
||||
sc->sample_count * sizeof(*sc->ctts_data));
|
||||
if (!sc->ctts_data) {
|
||||
av_free(ctts_data_old);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < ctts_count_old &&
|
||||
sc->ctts_count < sc->sample_count; i++)
|
||||
for (j = 0; j < ctts_data_old[i].count &&
|
||||
sc->ctts_count < sc->sample_count; j++)
|
||||
add_ctts_entry(&sc->ctts_data, &sc->ctts_count,
|
||||
&sc->ctts_allocated_size, 1,
|
||||
ctts_data_old[i].duration);
|
||||
av_free(ctts_data_old);
|
||||
}
|
||||
|
||||
for (i = 0; i < sc->chunk_count; i++) {
|
||||
int64_t next_offset = i+1 < sc->chunk_count ? sc->chunk_offsets[i+1] : INT64_MAX;
|
||||
current_offset = sc->chunk_offsets[i];
|
||||
@@ -6416,6 +6442,7 @@ static int should_retry(AVIOContext *pb, int error_code) {
|
||||
|
||||
static int mov_switch_root(AVFormatContext *s, int64_t target)
|
||||
{
|
||||
int ret;
|
||||
MOVContext *mov = s->priv_data;
|
||||
int i, j;
|
||||
int already_read = 0;
|
||||
@@ -6452,8 +6479,10 @@ static int mov_switch_root(AVFormatContext *s, int64_t target)
|
||||
|
||||
mov->found_mdat = 0;
|
||||
|
||||
if (mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
|
||||
avio_feof(s->pb))
|
||||
ret = mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX });
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (avio_feof(s->pb))
|
||||
return AVERROR_EOF;
|
||||
av_log(s, AV_LOG_TRACE, "read fragments, offset 0x%"PRIx64"\n", avio_tell(s->pb));
|
||||
|
||||
|
||||
@@ -719,8 +719,10 @@ static int ogg_read_header(AVFormatContext *s)
|
||||
"Headers mismatch for stream %d: "
|
||||
"expected %d received %d.\n",
|
||||
i, os->codec->nb_header, os->nb_header);
|
||||
if (s->error_recognition & AV_EF_EXPLODE)
|
||||
if (s->error_recognition & AV_EF_EXPLODE) {
|
||||
ogg_read_close(s);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
if (os->start_granule != OGG_NOGRANULE_VALUE)
|
||||
os->lastpts = s->streams[i]->start_time =
|
||||
|
||||
@@ -125,7 +125,7 @@ static int vp8_packet(AVFormatContext *s, int idx)
|
||||
os->lastdts = vp8_gptopts(s, idx, os->granule, NULL) - duration;
|
||||
if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
|
||||
s->streams[idx]->start_time = os->lastpts;
|
||||
if (s->streams[idx]->duration)
|
||||
if (s->streams[idx]->duration && s->streams[idx]->duration != AV_NOPTS_VALUE)
|
||||
s->streams[idx]->duration -= s->streams[idx]->start_time;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-8
@@ -1738,10 +1738,11 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
|
||||
// last dts seen for this stream. if any of packets following
|
||||
// current one had no dts, we will set this to AV_NOPTS_VALUE.
|
||||
int64_t last_dts = next_pkt->dts;
|
||||
av_assert2(wrap_bits <= 64);
|
||||
while (pktl && next_pkt->pts == AV_NOPTS_VALUE) {
|
||||
if (pktl->pkt.stream_index == next_pkt->stream_index &&
|
||||
(av_compare_mod(next_pkt->dts, pktl->pkt.dts, 2LL << (wrap_bits - 1)) < 0)) {
|
||||
if (av_compare_mod(pktl->pkt.pts, pktl->pkt.dts, 2LL << (wrap_bits - 1))) {
|
||||
av_compare_mod(next_pkt->dts, pktl->pkt.dts, 2ULL << (wrap_bits - 1)) < 0) {
|
||||
if (av_compare_mod(pktl->pkt.pts, pktl->pkt.dts, 2ULL << (wrap_bits - 1))) {
|
||||
// not B-frame
|
||||
next_pkt->pts = pktl->pkt.dts;
|
||||
}
|
||||
@@ -3882,12 +3883,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
}
|
||||
|
||||
// close codecs which were opened in try_decode_frame()
|
||||
for (i = 0; i < ic->nb_streams; i++) {
|
||||
st = ic->streams[i];
|
||||
avcodec_close(st->internal->avctx);
|
||||
}
|
||||
|
||||
ff_rfps_calculate(ic);
|
||||
|
||||
for (i = 0; i < ic->nb_streams; i++) {
|
||||
@@ -4078,6 +4073,7 @@ find_stream_info_err:
|
||||
st = ic->streams[i];
|
||||
if (st->info)
|
||||
av_freep(&st->info->duration_error);
|
||||
avcodec_close(ic->streams[i]->internal->avctx);
|
||||
av_freep(&ic->streams[i]->info);
|
||||
av_bsf_free(&ic->streams[i]->internal->extract_extradata.bsf);
|
||||
av_packet_free(&ic->streams[i]->internal->extract_extradata.pkt);
|
||||
|
||||
@@ -36,11 +36,11 @@ void ff_butterflies_float_vfp(float *av_restrict v1, float *av_restrict v2, int
|
||||
|
||||
av_cold void ff_float_dsp_init_vfp(AVFloatDSPContext *fdsp, int cpu_flags)
|
||||
{
|
||||
if (!have_vfpv3(cpu_flags)) {
|
||||
if (have_vfp_vm(cpu_flags)) {
|
||||
fdsp->vector_fmul = ff_vector_fmul_vfp;
|
||||
fdsp->vector_fmul_window = ff_vector_fmul_window_vfp;
|
||||
}
|
||||
fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_vfp;
|
||||
if (!have_vfpv3(cpu_flags))
|
||||
if (have_vfp_vm(cpu_flags))
|
||||
fdsp->butterflies_float = ff_butterflies_float_vfp;
|
||||
}
|
||||
|
||||
@@ -485,7 +485,12 @@ static int dxva2_device_create9ex(AVHWDeviceContext *ctx, UINT adapter)
|
||||
if (FAILED(hr))
|
||||
return AVERROR_UNKNOWN;
|
||||
|
||||
IDirect3D9Ex_GetAdapterDisplayModeEx(d3d9ex, adapter, &modeex, NULL);
|
||||
modeex.Size = sizeof(D3DDISPLAYMODEEX);
|
||||
hr = IDirect3D9Ex_GetAdapterDisplayModeEx(d3d9ex, adapter, &modeex, NULL);
|
||||
if (FAILED(hr)) {
|
||||
IDirect3D9Ex_Release(d3d9ex);
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
d3dpp.BackBufferFormat = modeex.Format;
|
||||
|
||||
|
||||
@@ -1076,80 +1076,11 @@ static void vaapi_unmap_to_drm(AVHWFramesContext *dst_fc,
|
||||
static int vaapi_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst,
|
||||
const AVFrame *src, int flags)
|
||||
{
|
||||
#if CONFIG_VAAPI_1
|
||||
AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx;
|
||||
VASurfaceID surface_id;
|
||||
VAStatus vas;
|
||||
VADRMPRIMESurfaceDescriptor va_desc;
|
||||
AVDRMFrameDescriptor *drm_desc = NULL;
|
||||
int err, i, j;
|
||||
|
||||
surface_id = (VASurfaceID)(uintptr_t)src->data[3];
|
||||
|
||||
vas = vaExportSurfaceHandle(hwctx->display, surface_id,
|
||||
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2,
|
||||
VA_EXPORT_SURFACE_READ_ONLY |
|
||||
VA_EXPORT_SURFACE_SEPARATE_LAYERS,
|
||||
&va_desc);
|
||||
if (vas != VA_STATUS_SUCCESS) {
|
||||
if (vas == VA_STATUS_ERROR_UNIMPLEMENTED)
|
||||
return AVERROR(ENOSYS);
|
||||
av_log(hwfc, AV_LOG_ERROR, "Failed to export surface %#x: "
|
||||
"%d (%s).\n", surface_id, vas, vaErrorStr(vas));
|
||||
return AVERROR(EIO);
|
||||
}
|
||||
|
||||
drm_desc = av_mallocz(sizeof(*drm_desc));
|
||||
if (!drm_desc) {
|
||||
err = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// By some bizarre coincidence, these structures are very similar...
|
||||
drm_desc->nb_objects = va_desc.num_objects;
|
||||
for (i = 0; i < va_desc.num_objects; i++) {
|
||||
drm_desc->objects[i].fd = va_desc.objects[i].fd;
|
||||
drm_desc->objects[i].size = va_desc.objects[i].size;
|
||||
drm_desc->objects[i].format_modifier =
|
||||
va_desc.objects[i].drm_format_modifier;
|
||||
}
|
||||
drm_desc->nb_layers = va_desc.num_layers;
|
||||
for (i = 0; i < va_desc.num_layers; i++) {
|
||||
drm_desc->layers[i].format = va_desc.layers[i].drm_format;
|
||||
drm_desc->layers[i].nb_planes = va_desc.layers[i].num_planes;
|
||||
for (j = 0; j < va_desc.layers[i].num_planes; j++) {
|
||||
drm_desc->layers[i].planes[j].object_index =
|
||||
va_desc.layers[i].object_index[j];
|
||||
drm_desc->layers[i].planes[j].offset =
|
||||
va_desc.layers[i].offset[j];
|
||||
drm_desc->layers[i].planes[j].pitch =
|
||||
va_desc.layers[i].pitch[j];
|
||||
}
|
||||
}
|
||||
|
||||
err = ff_hwframe_map_create(src->hw_frames_ctx, dst, src,
|
||||
&vaapi_unmap_to_drm, drm_desc);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
dst->width = src->width;
|
||||
dst->height = src->height;
|
||||
dst->data[0] = (uint8_t*)drm_desc;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
for (i = 0; i < va_desc.num_objects; i++)
|
||||
close(va_desc.objects[i].fd);
|
||||
av_freep(&drm_desc);
|
||||
return err;
|
||||
#else
|
||||
// Older versions without vaExportSurfaceHandle() are not supported -
|
||||
// in theory this is possible with a combination of vaDeriveImage()
|
||||
// and vaAcquireBufferHandle(), but it doesn't carry enough metadata
|
||||
// to actually use the result in a generic way.
|
||||
return AVERROR(ENOSYS);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ static const SoftFloat FLOAT_EPSILON = { 0x29F16B12, -16};
|
||||
static const SoftFloat FLOAT_1584893192 = { 0x32B771ED, 1}; ///< 1.584893192 (10^.2)
|
||||
static const SoftFloat FLOAT_100000 = { 0x30D40000, 17}; ///< 100000
|
||||
static const SoftFloat FLOAT_0999999 = { 0x3FFFFBCE, 0}; ///< 0.999999
|
||||
static const SoftFloat FLOAT_MIN = { 0x20000000, MIN_EXP};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user