Compare commits
174 Commits
n2.6.5
...
release/2.6
| Author | SHA1 | Date | |
|---|---|---|---|
| a3fd812644 | |||
| ebd4d7189c | |||
| 063382610f | |||
| 342b6d3718 | |||
| 74b8c4a60b | |||
| 2ea09e56cc | |||
| c57ebf6809 | |||
| 72d8ce1cf2 | |||
| 19fcdd0c2f | |||
| 542cc06c64 | |||
| 987082ff91 | |||
| 17e7cb98be | |||
| 945899864a | |||
| e49d142fc0 | |||
| f3ec2a0859 | |||
| 036d049fb1 | |||
| 6a60de92b2 | |||
| 6ec9611971 | |||
| cb7809cc4d | |||
| 42fc190ab0 | |||
| f2019a0db6 | |||
| e1fb0a1dbc | |||
| b55b843cd9 | |||
| b3d36aec75 | |||
| 1eb1c2fd5d | |||
| ba959ea35c | |||
| b987e8a38b | |||
| b653f7999a | |||
| d33cc39eb8 | |||
| 20196b6abd | |||
| 578e499864 | |||
| 778ee32990 | |||
| 97da8f43a4 | |||
| b6d9ecfe22 | |||
| 32a453eae2 | |||
| 6d36d0ade9 | |||
| e0d4decf52 | |||
| 7bf84d1c2b | |||
| bd641685f4 | |||
| ff1093efe0 | |||
| 53128080eb | |||
| a3a5aedc07 | |||
| d91a03d46c | |||
| 684e189eb3 | |||
| 361af0a47c | |||
| f71e0b798a | |||
| e4b4f9e2dc | |||
| 3bb83fd033 | |||
| a967e55157 | |||
| 50ca8b72d5 | |||
| 517c856d7f | |||
| 302a3269d6 | |||
| 4950c02d44 | |||
| 0d312030d2 | |||
| ee5ba0a1ad | |||
| 4de7481194 | |||
| 0b70b546a2 | |||
| 1733981ec3 | |||
| 2b7f125af7 | |||
| 8394fa2696 | |||
| 524ee42050 | |||
| 372ea28f68 | |||
| c48296d3bf | |||
| aea2f5a6ee | |||
| 78c9e1f00b | |||
| 9acbe5fa84 | |||
| 0f091f808a | |||
| 1d8a6a46a3 | |||
| e577e712a8 | |||
| 95e52303da | |||
| 20d4c087ed | |||
| b244e67f9c | |||
| 9dd768dc1e | |||
| eaba408421 | |||
| eadf932867 | |||
| b901d1bbc9 | |||
| 3fd30f53a9 | |||
| 80fc1f3399 | |||
| 82db8bcffa | |||
| 232c2ed4a4 | |||
| f0b6705e1a | |||
| 1ba90ce49e | |||
| 4bafd67795 | |||
| 8b93f6676b | |||
| 6d5fca34a6 | |||
| fbfef00e68 | |||
| 9b8d1a183d | |||
| 6d48354321 | |||
| 60956a9dc8 | |||
| 526b5facc5 | |||
| bb1263185b | |||
| aa5ae8b213 | |||
| c0315b74e2 | |||
| 81bac54ab3 | |||
| 482ca8241d | |||
| f3cf94fa47 | |||
| 85732714ce | |||
| dbe194002a | |||
| 9c4d8343bb | |||
| a5fb5a18e3 | |||
| bb70069e6a | |||
| b90796ab86 | |||
| d6ce1cb140 | |||
| b2cb7db14f | |||
| 462afe5d00 | |||
| c51800d324 | |||
| 4d2f936803 | |||
| c4b2985d9a | |||
| ea5ac146cd | |||
| 350f1f4919 | |||
| 564e63a033 | |||
| c1b7e9fe52 | |||
| d0d9fad2ba | |||
| 3f7bbb0ded | |||
| 10395b4738 | |||
| bc264004e0 | |||
| 8e053f61f5 | |||
| f821441795 | |||
| 3e8d9eade6 | |||
| 63c50350b6 | |||
| 7294d95689 | |||
| 8681296bb9 | |||
| 0fa22a42d6 | |||
| 929fd61602 | |||
| 09305dca59 | |||
| cc88d7a640 | |||
| e12f07b475 | |||
| 5164067861 | |||
| 354fa47018 | |||
| ad09bebe0c | |||
| e8fa0e3ec6 | |||
| 2e77ab8f10 | |||
| 00fde782a1 | |||
| 0350f373f7 | |||
| 4d8d2f1991 | |||
| 100dbe1bf0 | |||
| d8a66a150a | |||
| 93e168705d | |||
| a0a2bfbfd8 | |||
| 80a24e88e3 | |||
| 67b29888f4 | |||
| c84ec8d5c9 | |||
| 4916aa2383 | |||
| 40d5f570d8 | |||
| 20a96b9d8c | |||
| 6157938408 | |||
| 1f6aea2cc4 | |||
| 2da8c53386 | |||
| dd4c2fe74a | |||
| 292842a0ed | |||
| 43bd666fb4 | |||
| a90967013b | |||
| 7db1014b31 | |||
| ff663ae464 | |||
| d8c70ebd2c | |||
| f7b4e46251 | |||
| 1828abb744 | |||
| 4733060ef3 | |||
| e1b38b3685 | |||
| 26e98f9ae5 | |||
| 45430c3753 | |||
| a1b8fa1d9a | |||
| df660d6854 | |||
| 95b70b6567 | |||
| 48e86b6961 | |||
| b7d1bbe139 | |||
| d5009d6b6d | |||
| 4dc7e2dd82 | |||
| b91980edcf | |||
| de61d9f8a1 | |||
| 9b93805245 | |||
| 1d852105c2 | |||
| 8aeff8a013 | |||
| cf4b0fb4d6 |
@@ -1,6 +1,182 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 2.6.9:
|
||||
- avcodec/mjpegdec: Do not try to detect last scan but apply idct after all scans for progressive jpeg
|
||||
- avformat/options_table: Add missing identifier for very strict compliance
|
||||
- avformat/ffmdec: Check pix_fmt
|
||||
- avcodec/ttaenc: Reallocate packet if its too small
|
||||
- pgssubdec: fix subpicture output colorspace and range
|
||||
- avcodec/ac3dec: Reset SPX when switching from EAC3 to AC3
|
||||
- avfilter/vf_drawtext: Check return code of load_glyph()
|
||||
- avcodec/takdec: add code that got somehow lost in process of REing
|
||||
- avcodec/apedec: fix decoding of stereo files with one channel full of silence
|
||||
- avcodec/avpacket: Fix off by 5 error
|
||||
- avcodec/h264: Fix for H.264 configuration parsing
|
||||
- avcodec/bmp_parser: Ensure remaining_size is not too small in startcode packet crossing corner case
|
||||
- avfilter/src_movie: fix how we check for overflows with seek_point
|
||||
- avcodec/j2kenc: Add attribution to OpenJPEG project:
|
||||
- avcodec/libutvideodec: copy frame so it has reference counters when refcounted_frames is set
|
||||
- avformat/rtpdec_jpeg: fix low contrast image on low quality setting
|
||||
- avcodec/mjpegenc_common: Store approximate aspect if exact cannot be stored
|
||||
- avcodec/resample: Remove disabled and faulty code
|
||||
- indeo2: Fix banding artefacts
|
||||
- indeo2data: K&R formatting cosmetics
|
||||
- avcodec/imgconvert: Support non-planar colorspaces while padding
|
||||
- avutil/random_seed: Add the runtime in cycles of the main loop to the entropy pool
|
||||
- avutil/channel_layout: AV_CH_LAYOUT_6POINT1_BACK not reachable in parsing
|
||||
- avformat/concatdec: set safe mode to enabled instead of auto
|
||||
- avformat/rtpenc: Fix integer overflow in NTP_TO_RTP_FORMAT
|
||||
- avformat/cache: Fix memleak of tree entries
|
||||
- lavf/mov: fix sidx with edit lists (cherry picked from commit 3617e69d50dd9dd07b5011dfb9477a9d1a630354)
|
||||
- avcodec/mjpegdec: Fix decoding slightly odd progressive jpeg
|
||||
- avcodec/avpacket: clear priv in av_init_packet()
|
||||
- swscale/utils: Fix chrSrcHSubSample for GBRAP16
|
||||
- swscale/input: Fix GBRAP16 input
|
||||
- postproc: fix unaligned access
|
||||
- avutil/pixdesc: Make get_color_type() aware of CIE XYZ formats
|
||||
- swscale/x86/output: Fix yuv2planeX_16* with unaligned destination
|
||||
- swscale/x86/output: Move code into yuv2planeX_mainloop
|
||||
- doc/utils: fix typo for min() description
|
||||
|
||||
|
||||
version 2.6.8:
|
||||
- MAINTAINERS: remove unmaintained releases
|
||||
- avcodec/jpeg2000dec: More completely check cdef
|
||||
- avutil/opt: check for and handle errors in av_opt_set_dict2()
|
||||
- avcodec/flacenc: fix calculation of bits required in case of custom sample rate
|
||||
- avformat: Document urls a bit
|
||||
- avformat/libquvi: Set default demuxer and protocol limitations
|
||||
- avformat/concat: Check protocol prefix
|
||||
- doc/demuxers: Document enable_drefs and use_absolute_path
|
||||
- avcodec/mjpegdec: Check for end for both bytes in unescaping
|
||||
- avcodec/mpegvideo_enc: Check for integer overflow in ff_mpv_reallocate_putbitbuffer()
|
||||
- avformat/avformat: Replace some references to filenames by urls
|
||||
- avcodec/wmaenc: Check ff_wma_init() for failure
|
||||
- avcodec/mpeg12enc: Move high resolution thread check to before initializing threads
|
||||
- avformat/avio: Limit url option parsing to the documented cases
|
||||
- avcodec/ass_split: Fix null pointer dereference in ff_ass_style_get()
|
||||
- mov: Add an option to toggle dref opening
|
||||
- avcodec/gif: Fix lzw buffer size
|
||||
- avcodec/put_bits: Assert buf_ptr in flush_put_bits()
|
||||
- avcodec/tiff: Check subsample & rps values more completely
|
||||
- swscale/swscale: Add some sanity checks for srcSlice* parameters
|
||||
- swscale/x86/rgb2rgb_template: Fix planar2x() for short width
|
||||
- swscale/swscale_unscaled: Fix odd height inputs for bayer_to_yv12_wrapper()
|
||||
- swscale/swscale_unscaled: Fix odd height inputs for bayer_to_rgb24_wrapper()
|
||||
- avcodec/aacenc: Check both channels for finiteness
|
||||
- swscale/swscale-test: Fix slice height in random reference data creation.
|
||||
- dca: fix misaligned access in avpriv_dca_convert_bitstream
|
||||
- brstm: fix missing closing brace
|
||||
- brstm: also allocate b->table in read_packet
|
||||
- brstm: make sure an ADPC chunk was read for adpcm_thp
|
||||
- vorbisdec: reject rangebits 0 with non-0 partitions
|
||||
- vorbisdec: reject channel mapping with less than two channels
|
||||
- ffmdec: reset packet_end in case of failure
|
||||
- avformat/ipmovie: put video decoding_map_size into packet and use it in decoder
|
||||
|
||||
version 2.6.7:
|
||||
- configure: bump copyright year to 2016
|
||||
- avformat/hls: Even stricter URL checks
|
||||
- avformat/hls: More strict url checks
|
||||
- swscale/utils: Detect and skip unneeded sws_setColorspaceDetails() calls
|
||||
- swscale/yuv2rgb: Increase YUV2RGB table headroom
|
||||
- swscale/yuv2rgb: Factor YUVRGB_TABLE_LUMA_HEADROOM out
|
||||
- avformat/hls: forbid all protocols except http(s) & file
|
||||
- avformat/aviobuf: Fix end check in put_str16()
|
||||
- avformat/asfenc: Check pts
|
||||
- avcodec/mpeg4video: Check time_incr
|
||||
- avcodec/wavpackenc: Check the number of channels
|
||||
- avcodec/wavpackenc: Headers are per channel
|
||||
- avcodec/dvdec: Fix "left shift of negative value -254"
|
||||
- avcodec/mjpegdec: Fix negative shift
|
||||
- avcodec/mss2: Check for repeat overflow
|
||||
- avformat: Add integer fps from 31 to 60 to get_std_framerate()
|
||||
- avcodec/mpegvideo_enc: Clip bits_per_raw_sample within valid range
|
||||
- avfilter/vf_scale: set proper out frame color range
|
||||
- avcodec/motion_est: Fix mv_penalty table size
|
||||
- avcodec/h264_slice: Fix integer overflow in implicit weight computation
|
||||
- swscale/utils: Use normal bilinear scaler if fast cannot be used due to tiny dimensions
|
||||
- avcodec/put_bits: Always check buffer end before writing
|
||||
- mjpegdec: extend check for incompatible values of s->rgb and s->ls
|
||||
- swscale/utils: Fix intermediate format for cascaded alpha downscaling
|
||||
- x86/float_dsp: zero extend offset from ff_scalarproduct_float_sse
|
||||
|
||||
|
||||
version 2.6.6:
|
||||
- nuv: sanitize negative fps rate
|
||||
- rawdec: only exempt BIT0 with need_copy from buffer sanity check
|
||||
- mlvdec: check that index_entries exist
|
||||
- nutdec: reject negative value_len in read_sm_data
|
||||
- xwddec: prevent overflow of lsize * avctx->height
|
||||
- nutdec: only copy the header if it exists
|
||||
- exr: fix out of bounds read in get_code
|
||||
- on2avc: limit number of bits to 30 in get_egolomb
|
||||
- avcodec/mpeg4videodec: also for empty partitioned slices
|
||||
- avcodec/h264_refs: Fix long_idx check
|
||||
- avfilter/vf_mpdecimate: Add missing emms_c()
|
||||
- avformat/mxfenc: Do not crash if there is no packet in the first stream
|
||||
- avformat/utils: estimate_timings_from_pts - increase retry counter, fixes invalid duration for ts files with hevc codec
|
||||
- avformat/matroskaenc: Check codecdelay before use
|
||||
- avutil/mathematics: Fix division by 0
|
||||
- avcodec/hevc: Check max ctb addresses for WPP
|
||||
- avcodec/vp3: ensure header is parsed successfully before tables
|
||||
- avcodec/jpeg2000dec: Check bpno in decode_cblk()
|
||||
- avcodec/pgssubdec: Fix left shift of 255 by 24 places cannot be represented in type int
|
||||
- swscale/utils: Fix for runtime error: left shift of negative value -1
|
||||
- avcodec/hevc: Fix integer overflow of entry_point_offset
|
||||
- avcodec/dirac_parser: Add basic validity checks for next_pu_offset and prev_pu_offset
|
||||
- avcodec/dirac_parser: Fix potential overflows in pointer checks
|
||||
- avcodec/wmaprodec: Check bits per sample to be within the range not causing integer overflows
|
||||
- avcodec/wmaprodec: Fix overflow of cutoff
|
||||
- avformat/smacker: fix integer overflow with pts_inc
|
||||
- avcodec/vp3: Fix "runtime error: left shift of negative value"
|
||||
- mpegencts: Fix overflow in cbr mode period calculations
|
||||
- avutil/timecode: Fix fps check
|
||||
- avutil/mathematics: return INT64_MIN (=AV_NOPTS_VALUE) from av_rescale_rnd() for overflows
|
||||
- avcodec/apedec: Check length in long_filter_high_3800()
|
||||
- avcodec/vp3: always set pix_fmt in theora_decode_header()
|
||||
- avutil/mathematics: Do not treat INT64_MIN as positive in av_rescale_rnd
|
||||
- avutil/integer: Fix av_mod_i() with negative dividend
|
||||
- avformat/dump: Fix integer overflow in av_dump_format()
|
||||
- avcodec/utils: Clear dimensions in ff_get_buffer() on failure
|
||||
- avcodec/utils: Use 64bit for aspect ratio calculation in avcodec_string()
|
||||
- avcodec/vp3: Clear context on reinitialization failure
|
||||
- avcodec/hevc: allocate entries unconditionally
|
||||
- avcodec/hevc_cabac: Fix multiple integer overflows
|
||||
- avcodec/jpeg2000dwt: Check ndeclevels before calling dwt_encode*()
|
||||
- avcodec/jpeg2000dwt: Check ndeclevels before calling dwt_decode*()
|
||||
- avcodec/hevc: Check entry_point_offsets
|
||||
- avcodec/cabac: Check initial cabac decoder state
|
||||
- avcodec/cabac_functions: Fix "left shift of negative value -31767"
|
||||
- avcodec/h264_slice: Limit max_contexts when slice_context_count is initialized
|
||||
- avcodec/vp8: Do not use num_coeff_partitions in thread/buffer setup
|
||||
- avcodec/mpeg4videodec: Check available data before reading custom matrix
|
||||
- mjpegdec: consider chroma subsampling in size check
|
||||
- avcodec/dirac_parser: Check that there is a previous PU before accessing it
|
||||
- sonic: make sure num_taps * channels is not larger than frame_size
|
||||
- opus_silk: fix typo causing overflow in silk_stabilize_lsf
|
||||
- ffm: reject invalid codec_id and codec_type
|
||||
- golomb: always check for invalid UE golomb codes in get_ue_golomb
|
||||
- aaccoder: prevent crash of anmr coder
|
||||
- ffmdec: reject zero-sized chunks
|
||||
- swscale/x86/rgb2rgb_template: Fallback to mmx in interleaveBytes() if the alignment is insufficient for SSE*
|
||||
- swscale/x86/rgb2rgb_template: Do not crash on misaligend stride
|
||||
- avcodec/ffv1dec: Clear quant_table_count if its invalid
|
||||
- avcodec/ffv1dec: Print an error if the quant table count is invalid
|
||||
- doc/filters/drawtext: fix centering example
|
||||
- mxfdec: check edit_rate also for physical_track
|
||||
- mpegvideo: clear overread in clear_context
|
||||
- dvdsubdec: validate offset2 similar to offset1
|
||||
- aacdec: don't return frames without data from aac_decode_er_frame
|
||||
- avcodec/takdec: Use memove, avoid undefined memcpy() use
|
||||
- riffdec: prevent negative bit rate
|
||||
- Merge commit 'd80811c94e068085aab797f9ba35790529126f85'
|
||||
- s302m: fix arithmetic exception
|
||||
- avcodec/s302m: Only set the sample rate when some data is output
|
||||
- vp9: add support for resolution changes in inter frames.
|
||||
|
||||
|
||||
version 2.6.5:
|
||||
- rtmpcrypt: Do the xtea decryption in little endian mode
|
||||
- avformat/matroskadec: Check subtitle stream before dereferencing
|
||||
|
||||
+1
-2
@@ -539,6 +539,7 @@ Windows ICL Matthew Oliver
|
||||
ADI/Blackfin DSP Marc Hoffman
|
||||
Sparc Roman Shaposhnik
|
||||
x86 Michael Niedermayer
|
||||
OS/2 KO Myung-Hun
|
||||
|
||||
|
||||
Releases
|
||||
@@ -546,8 +547,6 @@ Releases
|
||||
|
||||
2.6 Michael Niedermayer
|
||||
2.5 Michael Niedermayer
|
||||
2.4 Michael Niedermayer
|
||||
2.2 Michael Niedermayer
|
||||
|
||||
If you want to maintain an older release, please contact us
|
||||
|
||||
|
||||
@@ -5748,7 +5748,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 2015
|
||||
#define CONFIG_THIS_YEAR 2016
|
||||
#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
@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 2.6.5
|
||||
PROJECT_NUMBER = 2.6.9
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
||||
+21
-2
@@ -98,7 +98,7 @@ All subsequent file-related directives apply to that file.
|
||||
|
||||
@item @code{ffconcat version 1.0}
|
||||
Identify the script type and version. It also sets the @option{safe} option
|
||||
to 1 if it was to its default -1.
|
||||
to 1 if it was -1.
|
||||
|
||||
To make FFmpeg recognize the format automatically, this directive must
|
||||
appears exactly as is (no extra space or byte-order-mark) on the very first
|
||||
@@ -145,7 +145,9 @@ component.
|
||||
|
||||
If set to 0, any file name is accepted.
|
||||
|
||||
The default is -1, it is equivalent to 1 if the format was automatically
|
||||
The default is 1.
|
||||
|
||||
-1 is equivalent to 1 if the format was automatically
|
||||
probed and 0 otherwise.
|
||||
|
||||
@item auto_convert
|
||||
@@ -359,6 +361,23 @@ ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
@section mov/mp4/3gp/Quicktme
|
||||
|
||||
Quicktime / MP4 demuxer.
|
||||
|
||||
This demuxer accepts the following options:
|
||||
@table @option
|
||||
@item enable_drefs
|
||||
Enable loading of external tracks, disabled by default.
|
||||
Enabling this can theoretically leak information in some use cases.
|
||||
|
||||
@item use_absolute_path
|
||||
Allows loading of external tracks via absolute paths, disabled by default.
|
||||
Enabling this poses a security risk. It should only be enabled if the source
|
||||
is known to be non malicious.
|
||||
|
||||
@end table
|
||||
|
||||
@section mpegts
|
||||
|
||||
MPEG-2 transport stream demuxer.
|
||||
|
||||
+1
-1
@@ -4243,7 +4243,7 @@ within the parameter list.
|
||||
@item
|
||||
Show the text at the center of the video frame:
|
||||
@example
|
||||
drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
|
||||
drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
|
||||
@end example
|
||||
|
||||
@item
|
||||
|
||||
+1
-1
@@ -861,7 +861,7 @@ Return 1 if @var{x} is lesser than or equal to @var{y}, 0 otherwise.
|
||||
Return the maximum between @var{x} and @var{y}.
|
||||
|
||||
@item min(x, y)
|
||||
Return the maximum between @var{x} and @var{y}.
|
||||
Return the minimum between @var{x} and @var{y}.
|
||||
|
||||
@item mod(x, y)
|
||||
Compute the remainder of division of @var{x} by @var{y}.
|
||||
|
||||
@@ -691,7 +691,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
|
||||
}
|
||||
while (idx) {
|
||||
sce->sf_idx[bandaddr[idx]] = minq + q0;
|
||||
minq = paths[idx][minq].prev;
|
||||
minq = FFMAX(paths[idx][minq].prev, 0);
|
||||
idx--;
|
||||
}
|
||||
//set the same quantizers inside window groups
|
||||
|
||||
@@ -2919,6 +2919,11 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
spectral_to_sample(ac);
|
||||
|
||||
if (!ac->frame->data[0] && samples) {
|
||||
av_log(avctx, AV_LOG_ERROR, "no frame data found\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ac->frame->nb_samples = samples;
|
||||
ac->frame->sample_rate = avctx->sample_rate;
|
||||
*got_frame_ptr = 1;
|
||||
|
||||
+10
-2
@@ -578,8 +578,16 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
ics->group_len[w] = wi[ch].grouping[w];
|
||||
|
||||
apply_window_and_mdct(s, &cpe->ch[ch], overlap);
|
||||
if (isnan(cpe->ch->coeffs[0])) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input contains NaN\n");
|
||||
|
||||
if (isnan(cpe->ch[ch].coeffs[ 0]) || isinf(cpe->ch[ch].coeffs[ 0]) ||
|
||||
isnan(cpe->ch[ch].coeffs[ 128]) || isinf(cpe->ch[ch].coeffs[ 128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[2*128]) || isinf(cpe->ch[ch].coeffs[2*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[3*128]) || isinf(cpe->ch[ch].coeffs[3*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[4*128]) || isinf(cpe->ch[ch].coeffs[4*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[5*128]) || isinf(cpe->ch[ch].coeffs[5*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[6*128]) || isinf(cpe->ch[ch].coeffs[6*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[7*128]) || isinf(cpe->ch[ch].coeffs[7*128])) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-5
@@ -902,11 +902,13 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
ff_eac3_default_spx_band_struct,
|
||||
&s->num_spx_bands,
|
||||
s->spx_band_sizes);
|
||||
} else {
|
||||
for (ch = 1; ch <= fbw_channels; ch++) {
|
||||
s->channel_uses_spx[ch] = 0;
|
||||
s->first_spx_coords[ch] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!s->eac3 || !s->spx_in_use) {
|
||||
s->spx_in_use = 0;
|
||||
for (ch = 1; ch <= fbw_channels; ch++) {
|
||||
s->channel_uses_spx[ch] = 0;
|
||||
s->first_spx_coords[ch] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -892,6 +892,9 @@ static void long_filter_high_3800(int32_t *buffer, int order, int shift, int len
|
||||
int32_t dotprod, sign;
|
||||
int32_t coeffs[256], delay[256];
|
||||
|
||||
if (order >= length)
|
||||
return;
|
||||
|
||||
memset(coeffs, 0, order * sizeof(*coeffs));
|
||||
for (i = 0; i < order; i++)
|
||||
delay[i] = buffer[i];
|
||||
@@ -1369,7 +1372,7 @@ static void ape_unpack_stereo(APEContext *ctx, int count)
|
||||
int32_t *decoded0 = ctx->decoded[0];
|
||||
int32_t *decoded1 = ctx->decoded[1];
|
||||
|
||||
if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {
|
||||
if ((ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) == APE_FRAMECODE_STEREO_SILENCE) {
|
||||
/* We are pure silence, so we're done. */
|
||||
av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence stereo\n");
|
||||
return;
|
||||
|
||||
@@ -523,7 +523,7 @@ ASSStyle *ff_ass_style_get(ASSSplitContext *ctx, const char *style)
|
||||
if (!style || !*style)
|
||||
style = "Default";
|
||||
for (i=0; i<ass->styles_count; i++)
|
||||
if (!strcmp(ass->styles[i].name, style))
|
||||
if (ass->styles[i].name && !strcmp(ass->styles[i].name, style))
|
||||
return ass->styles + i;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ void av_init_packet(AVPacket *pkt)
|
||||
#if FF_API_DESTRUCT_PACKET
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
pkt->destruct = NULL;
|
||||
pkt->priv = NULL;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
pkt->buf = NULL;
|
||||
@@ -387,10 +388,12 @@ int av_packet_split_side_data(AVPacket *pkt){
|
||||
p = pkt->data + pkt->size - 8 - 5;
|
||||
for (i=1; ; i++){
|
||||
size = AV_RB32(p);
|
||||
if (size>INT_MAX || p - pkt->data < size)
|
||||
if (size>INT_MAX - 5 || p - pkt->data < size)
|
||||
return 0;
|
||||
if (p[4]&128)
|
||||
break;
|
||||
if (p - pkt->data < size + 5)
|
||||
return 0;
|
||||
p-= size+5;
|
||||
}
|
||||
|
||||
@@ -401,7 +404,7 @@ int av_packet_split_side_data(AVPacket *pkt){
|
||||
p= pkt->data + pkt->size - 8 - 5;
|
||||
for (i=0; ; i++){
|
||||
size= AV_RB32(p);
|
||||
av_assert0(size<=INT_MAX && p - pkt->data >= size);
|
||||
av_assert0(size<=INT_MAX - 5 && p - pkt->data >= size);
|
||||
pkt->side_data[i].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
pkt->side_data[i].size = size;
|
||||
pkt->side_data[i].type = p[4]&127;
|
||||
|
||||
@@ -63,7 +63,7 @@ restart:
|
||||
continue;
|
||||
}
|
||||
bpc->pc.frame_start_found++;
|
||||
bpc->remaining_size = bpc->fsize + i - 17;
|
||||
bpc->remaining_size = bpc->fsize + FFMAX(i - 17, 0);
|
||||
|
||||
if (bpc->pc.index + i > 17) {
|
||||
next = i - 17;
|
||||
|
||||
+4
-1
@@ -51,7 +51,7 @@ void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size){
|
||||
*
|
||||
* @param buf_size size of buf in bits
|
||||
*/
|
||||
void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){
|
||||
int ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){
|
||||
c->bytestream_start=
|
||||
c->bytestream= buf;
|
||||
c->bytestream_end= buf + buf_size;
|
||||
@@ -64,6 +64,9 @@ void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){
|
||||
#endif
|
||||
c->low+= ((*c->bytestream++)<<2) + 2;
|
||||
c->range= 0x1FE;
|
||||
if ((c->range<<(CABAC_BITS+1)) < c->low)
|
||||
return AVERROR_INVALIDDATA;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ff_init_cabac_states(void)
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ typedef struct CABACContext{
|
||||
}CABACContext;
|
||||
|
||||
void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size);
|
||||
void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size);
|
||||
int ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size);
|
||||
void ff_init_cabac_states(void);
|
||||
|
||||
#endif /* AVCODEC_CABAC_H */
|
||||
|
||||
@@ -74,7 +74,8 @@ static inline void renorm_cabac_decoder_once(CABACContext *c){
|
||||
|
||||
#ifndef get_cabac_inline
|
||||
static void refill2(CABACContext *c){
|
||||
int i, x;
|
||||
int i;
|
||||
unsigned x;
|
||||
|
||||
x= c->low ^ (c->low-1);
|
||||
i= 7 - ff_h264_norm_shift[x>>(CABAC_BITS-1)];
|
||||
@@ -190,7 +191,8 @@ static av_unused const uint8_t* skip_bytes(CABACContext *c, int n) {
|
||||
#endif
|
||||
if ((int) (c->bytestream_end - ptr) < n)
|
||||
return NULL;
|
||||
ff_init_cabac_decoder(c, ptr + n, c->bytestream_end - ptr - n);
|
||||
if (ff_init_cabac_decoder(c, ptr + n, c->bytestream_end - ptr - n) < 0)
|
||||
return NULL;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
+5
-4
@@ -41,8 +41,6 @@ int avpriv_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst,
|
||||
{
|
||||
uint32_t mrk;
|
||||
int i, tmp;
|
||||
const uint16_t *ssrc = (const uint16_t *) src;
|
||||
uint16_t *sdst = (uint16_t *) dst;
|
||||
PutBitContext pb;
|
||||
|
||||
if ((unsigned) src_size > (unsigned) max_size)
|
||||
@@ -54,8 +52,11 @@ int avpriv_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst,
|
||||
memcpy(dst, src, src_size);
|
||||
return src_size;
|
||||
case DCA_SYNCWORD_CORE_LE:
|
||||
for (i = 0; i < (src_size + 1) >> 1; i++)
|
||||
*sdst++ = av_bswap16(*ssrc++);
|
||||
for (i = 0; i < (src_size + 1) >> 1; i++) {
|
||||
AV_WB16(dst, AV_RL16(src));
|
||||
src += 2;
|
||||
dst += 2;
|
||||
}
|
||||
return src_size;
|
||||
case DCA_SYNCWORD_CORE_14B_BE:
|
||||
case DCA_SYNCWORD_CORE_14B_LE:
|
||||
|
||||
@@ -100,10 +100,12 @@ typedef struct DiracParseUnit {
|
||||
static int unpack_parse_unit(DiracParseUnit *pu, DiracParseContext *pc,
|
||||
int offset)
|
||||
{
|
||||
uint8_t *start = pc->buffer + offset;
|
||||
uint8_t *end = pc->buffer + pc->index;
|
||||
if (start < pc->buffer || (start + 13 > end))
|
||||
int8_t *start;
|
||||
|
||||
if (offset < 0 || pc->index - 13 < offset)
|
||||
return 0;
|
||||
|
||||
start = pc->buffer + offset;
|
||||
pu->pu_type = start[4];
|
||||
|
||||
pu->next_pu_offset = AV_RB32(start + 5);
|
||||
@@ -112,6 +114,15 @@ static int unpack_parse_unit(DiracParseUnit *pu, DiracParseContext *pc,
|
||||
if (pu->pu_type == 0x10 && pu->next_pu_offset == 0)
|
||||
pu->next_pu_offset = 13;
|
||||
|
||||
if (pu->next_pu_offset && pu->next_pu_offset < 13) {
|
||||
av_log(NULL, AV_LOG_ERROR, "next_pu_offset %d is invalid\n", pu->next_pu_offset);
|
||||
return 0;
|
||||
}
|
||||
if (pu->prev_pu_offset && pu->prev_pu_offset < 13) {
|
||||
av_log(NULL, AV_LOG_ERROR, "prev_pu_offset %d is invalid\n", pu->prev_pu_offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -190,7 +201,7 @@ static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
/* Get the picture number to set the pts and dts*/
|
||||
if (parse_timing_info) {
|
||||
if (parse_timing_info && pu1.prev_pu_offset >= 13) {
|
||||
uint8_t *cur_pu = pc->buffer +
|
||||
pc->index - 13 - pu1.prev_pu_offset;
|
||||
int pts = AV_RB32(cur_pu + 13);
|
||||
|
||||
+1
-1
@@ -333,7 +333,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
|
||||
dct_mode * 22 * 64 +
|
||||
(quant + ff_dv_quant_offset[class1]) * 64];
|
||||
}
|
||||
dc = dc << 2;
|
||||
dc = dc * 4;
|
||||
/* convert to unsigned because 128 is not added in the
|
||||
* standard IDCT */
|
||||
dc += 1024;
|
||||
|
||||
@@ -346,7 +346,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
|
||||
}
|
||||
}
|
||||
the_end:
|
||||
if (offset1 >= 0) {
|
||||
if (offset1 >= 0 && offset2 >= 0) {
|
||||
int w, h;
|
||||
uint8_t *bitmap;
|
||||
|
||||
|
||||
+5
-5
@@ -459,7 +459,7 @@ static int huf_build_dec_table(const uint64_t *hcode, int im,
|
||||
lc += 8; \
|
||||
}
|
||||
|
||||
#define get_code(po, rlc, c, lc, gb, out, oe) \
|
||||
#define get_code(po, rlc, c, lc, gb, out, oe, outb) \
|
||||
{ \
|
||||
if (po == rlc) { \
|
||||
if (lc < 8) \
|
||||
@@ -468,7 +468,7 @@ static int huf_build_dec_table(const uint64_t *hcode, int im,
|
||||
\
|
||||
cs = c >> lc; \
|
||||
\
|
||||
if (out + cs > oe) \
|
||||
if (out + cs > oe || out == outb) \
|
||||
return AVERROR_INVALIDDATA; \
|
||||
\
|
||||
s = out[-1]; \
|
||||
@@ -501,7 +501,7 @@ static int huf_decode(const uint64_t *hcode, const HufDec *hdecod,
|
||||
|
||||
if (pl.len) {
|
||||
lc -= pl.len;
|
||||
get_code(pl.lit, rlc, c, lc, gb, out, oe);
|
||||
get_code(pl.lit, rlc, c, lc, gb, out, oe, outb);
|
||||
} else {
|
||||
int j;
|
||||
|
||||
@@ -518,7 +518,7 @@ static int huf_decode(const uint64_t *hcode, const HufDec *hdecod,
|
||||
if ((hcode[pl.p[j]] >> 6) ==
|
||||
((c >> (lc - l)) & ((1LL << l) - 1))) {
|
||||
lc -= l;
|
||||
get_code(pl.p[j], rlc, c, lc, gb, out, oe);
|
||||
get_code(pl.p[j], rlc, c, lc, gb, out, oe, outb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -539,7 +539,7 @@ static int huf_decode(const uint64_t *hcode, const HufDec *hdecod,
|
||||
|
||||
if (pl.len) {
|
||||
lc -= pl.len;
|
||||
get_code(pl.lit, rlc, c, lc, gb, out, oe);
|
||||
get_code(pl.lit, rlc, c, lc, gb, out, oe, outb);
|
||||
} else {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -567,8 +567,11 @@ static int read_extra_header(FFV1Context *f)
|
||||
}
|
||||
|
||||
f->quant_table_count = get_symbol(c, state, 0);
|
||||
if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || !f->quant_table_count)
|
||||
if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || !f->quant_table_count) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", f->quant_table_count);
|
||||
f->quant_table_count = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (i = 0; i < f->quant_table_count; i++) {
|
||||
f->context_count[i] = read_quant_tables(c, f->quant_tables[i]);
|
||||
|
||||
@@ -920,7 +920,7 @@ static int count_frame_header(FlacEncodeContext *s)
|
||||
count += 16;
|
||||
|
||||
/* explicit sample rate */
|
||||
count += ((s->sr_code[0] == 12) + (s->sr_code[0] > 12)) * 8;
|
||||
count += ((s->sr_code[0] == 12) + (s->sr_code[0] > 12) * 2) * 8;
|
||||
|
||||
/* frame header CRC-8 */
|
||||
count += 8;
|
||||
|
||||
+5
-2
@@ -43,6 +43,7 @@ typedef struct GIFContext {
|
||||
const AVClass *class;
|
||||
LZWState *lzw;
|
||||
uint8_t *buf;
|
||||
int buf_size;
|
||||
AVFrame *last_frame;
|
||||
int flags;
|
||||
uint32_t palette[AVPALETTE_COUNT]; ///< local reference palette for !pal8
|
||||
@@ -174,7 +175,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
|
||||
|
||||
bytestream_put_byte(bytestream, 0x08);
|
||||
|
||||
ff_lzw_encode_init(s->lzw, s->buf, 2 * width * height,
|
||||
ff_lzw_encode_init(s->lzw, s->buf, s->buf_size,
|
||||
12, FF_LZW_GIF, put_bits);
|
||||
|
||||
ptr = buf + y_start*linesize + x_start;
|
||||
@@ -232,7 +233,8 @@ static av_cold int gif_encode_init(AVCodecContext *avctx)
|
||||
s->transparent_index = -1;
|
||||
|
||||
s->lzw = av_mallocz(ff_lzw_encode_state_size);
|
||||
s->buf = av_malloc(avctx->width*avctx->height*2);
|
||||
s->buf_size = avctx->width*avctx->height*2 + 1000;
|
||||
s->buf = av_malloc(s->buf_size);
|
||||
s->tmpl = av_malloc(avctx->width);
|
||||
if (!s->tmpl || !s->buf || !s->lzw)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -324,6 +326,7 @@ static int gif_encode_close(AVCodecContext *avctx)
|
||||
|
||||
av_freep(&s->lzw);
|
||||
av_freep(&s->buf);
|
||||
s->buf_size = 0;
|
||||
av_frame_free(&s->last_frame);
|
||||
av_freep(&s->tmpl);
|
||||
return 0;
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ static inline int get_ue_golomb(GetBitContext *gb)
|
||||
int log = 2 * av_log2(buf) - 31;
|
||||
LAST_SKIP_BITS(re, gb, 32 - log);
|
||||
CLOSE_READER(re, gb);
|
||||
if (CONFIG_FTRAPV && log < 0) {
|
||||
if (log < 7) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Invalid UE golomb code\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1765,7 +1765,7 @@ static int is_extra(const uint8_t *buf, int buf_size)
|
||||
const uint8_t *p= buf+6;
|
||||
while(cnt--){
|
||||
int nalsize= AV_RB16(p) + 2;
|
||||
if(nalsize > buf_size - (p-buf) || p[2]!=0x67)
|
||||
if(nalsize > buf_size - (p-buf) || (p[2] & 0x9F) != 7)
|
||||
return 0;
|
||||
p += nalsize;
|
||||
}
|
||||
@@ -1774,7 +1774,7 @@ static int is_extra(const uint8_t *buf, int buf_size)
|
||||
return 0;
|
||||
while(cnt--){
|
||||
int nalsize= AV_RB16(p) + 2;
|
||||
if(nalsize > buf_size - (p-buf) || p[2]!=0x68)
|
||||
if(nalsize > buf_size - (p-buf) || (p[2] & 0x9F) != 8)
|
||||
return 0;
|
||||
p += nalsize;
|
||||
}
|
||||
|
||||
@@ -2000,6 +2000,7 @@ decode_intra_mb:
|
||||
const int mb_size = ff_h264_mb_sizes[h->sps.chroma_format_idc] *
|
||||
h->sps.bit_depth_luma >> 3;
|
||||
const uint8_t *ptr;
|
||||
int ret;
|
||||
|
||||
// We assume these blocks are very rare so we do not optimize it.
|
||||
// FIXME The two following lines get the bitstream position in the cabac
|
||||
@@ -2016,7 +2017,9 @@ decode_intra_mb:
|
||||
h->intra_pcm_ptr = ptr;
|
||||
ptr += mb_size;
|
||||
|
||||
ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr);
|
||||
ret = ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
// All blocks are present
|
||||
h->cbp_table[mb_xy] = 0xf7ef;
|
||||
|
||||
@@ -276,7 +276,7 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h)
|
||||
|
||||
long_idx = pic_num_extract(h, pic_id, &pic_structure);
|
||||
|
||||
if (long_idx > 31) {
|
||||
if (long_idx > 31U) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"long_term_pic_idx overflow\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -893,7 +893,7 @@ static void implicit_weight_table(H264Context *h, int field)
|
||||
cur_poc = h->cur_pic_ptr->field_poc[h->picture_structure - 1];
|
||||
}
|
||||
if (h->ref_count[0] == 1 && h->ref_count[1] == 1 && !FRAME_MBAFF(h) &&
|
||||
h->ref_list[0][0].poc + h->ref_list[1][0].poc == 2 * cur_poc) {
|
||||
h->ref_list[0][0].poc + (int64_t)h->ref_list[1][0].poc == 2 * cur_poc) {
|
||||
h->use_weight = 0;
|
||||
h->use_weight_chroma = 0;
|
||||
return;
|
||||
@@ -914,7 +914,7 @@ static void implicit_weight_table(H264Context *h, int field)
|
||||
h->chroma_log2_weight_denom = 5;
|
||||
|
||||
for (ref0 = ref_start; ref0 < ref_count0; ref0++) {
|
||||
int poc0 = h->ref_list[0][ref0].poc;
|
||||
int64_t poc0 = h->ref_list[0][ref0].poc;
|
||||
for (ref1 = ref_start; ref1 < ref_count1; ref1++) {
|
||||
int w = 32;
|
||||
if (!h->ref_list[0][ref0].long_ref && !h->ref_list[1][ref1].long_ref) {
|
||||
@@ -1194,6 +1194,7 @@ static int h264_slice_header_init(H264Context *h, int reinit)
|
||||
nb_slices = max_slices;
|
||||
}
|
||||
h->slice_context_count = nb_slices;
|
||||
h->max_contexts = FFMIN(h->max_contexts, nb_slices);
|
||||
|
||||
if (!HAVE_THREADS || !(h->avctx->active_thread_type & FF_THREAD_SLICE)) {
|
||||
ret = ff_h264_context_init(h);
|
||||
@@ -2421,13 +2422,16 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
|
||||
}
|
||||
|
||||
if (h->pps.cabac) {
|
||||
int ret;
|
||||
/* realign */
|
||||
align_get_bits(&h->gb);
|
||||
|
||||
/* init cabac */
|
||||
ff_init_cabac_decoder(&h->cabac,
|
||||
ret = ff_init_cabac_decoder(&h->cabac,
|
||||
h->gb.buffer + get_bits_count(&h->gb) / 8,
|
||||
(get_bits_left(&h->gb) + 7) / 8);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ff_h264_init_cabac_states(h);
|
||||
|
||||
|
||||
+19
-6
@@ -716,7 +716,7 @@ static int hls_slice_header(HEVCContext *s)
|
||||
av_freep(&sh->entry_point_offset);
|
||||
av_freep(&sh->offset);
|
||||
av_freep(&sh->size);
|
||||
sh->entry_point_offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(int));
|
||||
sh->entry_point_offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(unsigned));
|
||||
sh->offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(int));
|
||||
sh->size = av_malloc_array(sh->num_entry_point_offsets, sizeof(int));
|
||||
if (!sh->entry_point_offset || !sh->offset || !sh->size) {
|
||||
@@ -2420,8 +2420,8 @@ static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
|
||||
HEVCLocalContext *lc = s->HEVClc;
|
||||
int *ret = av_malloc_array(s->sh.num_entry_point_offsets + 1, sizeof(int));
|
||||
int *arg = av_malloc_array(s->sh.num_entry_point_offsets + 1, sizeof(int));
|
||||
int offset;
|
||||
int startheader, cmpt = 0;
|
||||
int64_t offset;
|
||||
int64_t startheader, cmpt = 0;
|
||||
int i, j, res = 0;
|
||||
|
||||
if (!ret || !arg) {
|
||||
@@ -2430,11 +2430,18 @@ static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
if (s->sh.slice_ctb_addr_rs + s->sh.num_entry_point_offsets * s->sps->ctb_width >= s->sps->ctb_width * s->sps->ctb_height) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "WPP ctb addresses are wrong (%d %d %d %d)\n",
|
||||
s->sh.slice_ctb_addr_rs, s->sh.num_entry_point_offsets,
|
||||
s->sps->ctb_width, s->sps->ctb_height
|
||||
);
|
||||
res = AVERROR_INVALIDDATA;
|
||||
goto error;
|
||||
}
|
||||
|
||||
ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
|
||||
|
||||
if (!s->sList[1]) {
|
||||
ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
|
||||
|
||||
|
||||
for (i = 1; i < s->threads_number; i++) {
|
||||
s->sList[i] = av_malloc(sizeof(HEVCContext));
|
||||
memcpy(s->sList[i], s, sizeof(HEVCContext));
|
||||
@@ -2467,6 +2474,11 @@ static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
|
||||
}
|
||||
if (s->sh.num_entry_point_offsets != 0) {
|
||||
offset += s->sh.entry_point_offset[s->sh.num_entry_point_offsets - 1] - cmpt;
|
||||
if (length < offset) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "entry_point_offset table is corrupted\n");
|
||||
res = AVERROR_INVALIDDATA;
|
||||
goto error;
|
||||
}
|
||||
s->sh.size[s->sh.num_entry_point_offsets - 1] = length - offset;
|
||||
s->sh.offset[s->sh.num_entry_point_offsets - 1] = offset;
|
||||
|
||||
@@ -2493,6 +2505,7 @@ static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
|
||||
|
||||
for (i = 0; i <= s->sh.num_entry_point_offsets; i++)
|
||||
res += ret[i];
|
||||
error:
|
||||
av_free(ret);
|
||||
av_free(arg);
|
||||
return res;
|
||||
|
||||
+1
-1
@@ -609,7 +609,7 @@ typedef struct SliceHeader {
|
||||
|
||||
unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand
|
||||
|
||||
int *entry_point_offset;
|
||||
unsigned *entry_point_offset;
|
||||
int * offset;
|
||||
int * size;
|
||||
int num_entry_point_offsets;
|
||||
|
||||
@@ -883,11 +883,13 @@ static av_always_inline int mvd_decode(HEVCContext *s)
|
||||
int k = 1;
|
||||
|
||||
while (k < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) {
|
||||
ret += 1 << k;
|
||||
ret += 1U << 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 0;
|
||||
}
|
||||
while (k--)
|
||||
ret += get_cabac_bypass(&s->HEVClc->cc) << k;
|
||||
return get_cabac_bypass_sign(&s->HEVClc->cc, -ret);
|
||||
@@ -1025,8 +1027,10 @@ 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)
|
||||
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);
|
||||
|
||||
+35
-2
@@ -236,9 +236,41 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
|
||||
int x_shift;
|
||||
int yheight;
|
||||
int i, y;
|
||||
int max_step[4];
|
||||
|
||||
if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB ||
|
||||
!is_yuv_planar(desc)) return -1;
|
||||
if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
|
||||
return -1;
|
||||
|
||||
if (!is_yuv_planar(desc)) {
|
||||
if (src)
|
||||
return -1; //TODO: Not yet implemented
|
||||
|
||||
av_image_fill_max_pixsteps(max_step, NULL, desc);
|
||||
|
||||
if (padtop || padleft) {
|
||||
memset(dst->data[0], color[0],
|
||||
dst->linesize[0] * padtop + (padleft * max_step[0]));
|
||||
}
|
||||
|
||||
if (padleft || padright) {
|
||||
optr = dst->data[0] + dst->linesize[0] * padtop +
|
||||
(dst->linesize[0] - (padright * max_step[0]));
|
||||
yheight = height - 1 - (padtop + padbottom);
|
||||
for (y = 0; y < yheight; y++) {
|
||||
memset(optr, color[0], (padleft + padright) * max_step[0]);
|
||||
optr += dst->linesize[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (padbottom || padright) {
|
||||
optr = dst->data[0] + dst->linesize[0] * (height - padbottom) -
|
||||
(padright * max_step[0]);
|
||||
memset(optr, color[0], dst->linesize[0] * padbottom +
|
||||
(padright * max_step[0]));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
x_shift = i ? desc->log2_chroma_w : 0;
|
||||
@@ -284,6 +316,7 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
|
||||
(padbottom >> y_shift) + (padright >> x_shift));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+9
-6
@@ -146,6 +146,7 @@ static int ir2_decode_frame(AVCodecContext *avctx,
|
||||
AVFrame *picture = data;
|
||||
AVFrame * const p = s->picture;
|
||||
int start, ret;
|
||||
int ltab, ctab;
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, p)) < 0)
|
||||
return ret;
|
||||
@@ -167,34 +168,36 @@ static int ir2_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
init_get_bits(&s->gb, buf + start, (buf_size - start) * 8);
|
||||
|
||||
ltab = buf[0x22] & 3;
|
||||
ctab = buf[0x22] >> 2;
|
||||
if (s->decode_delta) { /* intraframe */
|
||||
if ((ret = ir2_decode_plane(s, avctx->width, avctx->height,
|
||||
p->data[0], p->linesize[0],
|
||||
ir2_luma_table)) < 0)
|
||||
ir2_delta_table[ltab])) < 0)
|
||||
return ret;
|
||||
|
||||
/* swapped U and V */
|
||||
if ((ret = ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2,
|
||||
p->data[2], p->linesize[2],
|
||||
ir2_luma_table)) < 0)
|
||||
ir2_delta_table[ctab])) < 0)
|
||||
return ret;
|
||||
if ((ret = ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2,
|
||||
p->data[1], p->linesize[1],
|
||||
ir2_luma_table)) < 0)
|
||||
ir2_delta_table[ctab])) < 0)
|
||||
return ret;
|
||||
} else { /* interframe */
|
||||
if ((ret = ir2_decode_plane_inter(s, avctx->width, avctx->height,
|
||||
p->data[0], p->linesize[0],
|
||||
ir2_luma_table)) < 0)
|
||||
ir2_delta_table[ltab])) < 0)
|
||||
return ret;
|
||||
/* swapped U and V */
|
||||
if ((ret = ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2,
|
||||
p->data[2], p->linesize[2],
|
||||
ir2_luma_table)) < 0)
|
||||
ir2_delta_table[ctab])) < 0)
|
||||
return ret;
|
||||
if ((ret = ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2,
|
||||
p->data[1], p->linesize[1],
|
||||
ir2_luma_table)) < 0)
|
||||
ir2_delta_table[ctab])) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+201
-105
@@ -27,115 +27,211 @@
|
||||
#define IR2_CODES 143
|
||||
static const uint16_t ir2_codes[IR2_CODES][2] = {
|
||||
#ifdef BITSTREAM_READER_LE
|
||||
{0x0000, 3}, {0x0004, 3}, {0x0006, 3}, {0x0001, 5},
|
||||
{0x0009, 5}, {0x0019, 5}, {0x000D, 5}, {0x001D, 5},
|
||||
{0x0023, 6}, {0x0013, 6}, {0x0033, 6}, {0x000B, 6},
|
||||
{0x002B, 6}, {0x001B, 6}, {0x0007, 8}, {0x0087, 8},
|
||||
{0x0027, 8}, {0x00A7, 8}, {0x0067, 8}, {0x00E7, 8},
|
||||
{0x0097, 8}, {0x0057, 8}, {0x0037, 8}, {0x00B7, 8},
|
||||
{0x00F7, 8}, {0x000F, 9}, {0x008F, 9}, {0x018F, 9},
|
||||
{0x014F, 9}, {0x00CF, 9}, {0x002F, 9}, {0x012F, 9},
|
||||
{0x01AF, 9}, {0x006F, 9}, {0x00EF, 9}, {0x01EF, 9},
|
||||
{0x001F, 10}, {0x021F, 10}, {0x011F, 10}, {0x031F, 10},
|
||||
{0x009F, 10}, {0x029F, 10}, {0x019F, 10}, {0x039F, 10},
|
||||
{0x005F, 10}, {0x025F, 10}, {0x015F, 10}, {0x035F, 10},
|
||||
{0x00DF, 10}, {0x02DF, 10}, {0x01DF, 10}, {0x03DF, 10},
|
||||
{0x003F, 13}, {0x103F, 13}, {0x083F, 13}, {0x183F, 13},
|
||||
{0x043F, 13}, {0x143F, 13}, {0x0C3F, 13}, {0x1C3F, 13},
|
||||
{0x023F, 13}, {0x123F, 13}, {0x0A3F, 13}, {0x1A3F, 13},
|
||||
{0x063F, 13}, {0x163F, 13}, {0x0E3F, 13}, {0x1E3F, 13},
|
||||
{0x013F, 13}, {0x113F, 13}, {0x093F, 13}, {0x193F, 13},
|
||||
{0x053F, 13}, {0x153F, 13}, {0x0D3F, 13}, {0x1D3F, 13},
|
||||
{0x033F, 13}, {0x133F, 13}, {0x0B3F, 13}, {0x1B3F, 13},
|
||||
{0x073F, 13}, {0x173F, 13}, {0x0F3F, 13}, {0x1F3F, 13},
|
||||
{0x00BF, 13}, {0x10BF, 13}, {0x08BF, 13}, {0x18BF, 13},
|
||||
{0x04BF, 13}, {0x14BF, 13}, {0x0CBF, 13}, {0x1CBF, 13},
|
||||
{0x02BF, 13}, {0x12BF, 13}, {0x0ABF, 13}, {0x1ABF, 13},
|
||||
{0x06BF, 13}, {0x16BF, 13}, {0x0EBF, 13}, {0x1EBF, 13},
|
||||
{0x01BF, 13}, {0x11BF, 13}, {0x09BF, 13}, {0x19BF, 13},
|
||||
{0x05BF, 13}, {0x15BF, 13}, {0x0DBF, 13}, {0x1DBF, 13},
|
||||
{0x03BF, 13}, {0x13BF, 13}, {0x0BBF, 13}, {0x1BBF, 13},
|
||||
{0x07BF, 13}, {0x17BF, 13}, {0x0FBF, 13}, {0x1FBF, 13},
|
||||
{0x007F, 14}, {0x207F, 14}, {0x107F, 14}, {0x307F, 14},
|
||||
{0x087F, 14}, {0x287F, 14}, {0x187F, 14}, {0x387F, 14},
|
||||
{0x047F, 14}, {0x247F, 14}, {0x147F, 14}, {0x0002, 3},
|
||||
{0x0011, 5}, {0x0005, 5}, {0x0015, 5}, {0x0003, 6},
|
||||
{0x003B, 6}, {0x0047, 8}, {0x00C7, 8}, {0x0017, 8},
|
||||
{0x00D7, 8}, {0x0077, 8}, {0x010F, 9}, {0x004F, 9},
|
||||
{0x01CF, 9}, {0x00AF, 9}, {0x016F, 9},
|
||||
{ 0x0000, 3 }, { 0x0004, 3 }, { 0x0006, 3 }, { 0x0001, 5 },
|
||||
{ 0x0009, 5 }, { 0x0019, 5 }, { 0x000D, 5 }, { 0x001D, 5 },
|
||||
{ 0x0023, 6 }, { 0x0013, 6 }, { 0x0033, 6 }, { 0x000B, 6 },
|
||||
{ 0x002B, 6 }, { 0x001B, 6 }, { 0x0007, 8 }, { 0x0087, 8 },
|
||||
{ 0x0027, 8 }, { 0x00A7, 8 }, { 0x0067, 8 }, { 0x00E7, 8 },
|
||||
{ 0x0097, 8 }, { 0x0057, 8 }, { 0x0037, 8 }, { 0x00B7, 8 },
|
||||
{ 0x00F7, 8 }, { 0x000F, 9 }, { 0x008F, 9 }, { 0x018F, 9 },
|
||||
{ 0x014F, 9 }, { 0x00CF, 9 }, { 0x002F, 9 }, { 0x012F, 9 },
|
||||
{ 0x01AF, 9 }, { 0x006F, 9 }, { 0x00EF, 9 }, { 0x01EF, 9 },
|
||||
{ 0x001F, 10 }, { 0x021F, 10 }, { 0x011F, 10 }, { 0x031F, 10 },
|
||||
{ 0x009F, 10 }, { 0x029F, 10 }, { 0x019F, 10 }, { 0x039F, 10 },
|
||||
{ 0x005F, 10 }, { 0x025F, 10 }, { 0x015F, 10 }, { 0x035F, 10 },
|
||||
{ 0x00DF, 10 }, { 0x02DF, 10 }, { 0x01DF, 10 }, { 0x03DF, 10 },
|
||||
{ 0x003F, 13 }, { 0x103F, 13 }, { 0x083F, 13 }, { 0x183F, 13 },
|
||||
{ 0x043F, 13 }, { 0x143F, 13 }, { 0x0C3F, 13 }, { 0x1C3F, 13 },
|
||||
{ 0x023F, 13 }, { 0x123F, 13 }, { 0x0A3F, 13 }, { 0x1A3F, 13 },
|
||||
{ 0x063F, 13 }, { 0x163F, 13 }, { 0x0E3F, 13 }, { 0x1E3F, 13 },
|
||||
{ 0x013F, 13 }, { 0x113F, 13 }, { 0x093F, 13 }, { 0x193F, 13 },
|
||||
{ 0x053F, 13 }, { 0x153F, 13 }, { 0x0D3F, 13 }, { 0x1D3F, 13 },
|
||||
{ 0x033F, 13 }, { 0x133F, 13 }, { 0x0B3F, 13 }, { 0x1B3F, 13 },
|
||||
{ 0x073F, 13 }, { 0x173F, 13 }, { 0x0F3F, 13 }, { 0x1F3F, 13 },
|
||||
{ 0x00BF, 13 }, { 0x10BF, 13 }, { 0x08BF, 13 }, { 0x18BF, 13 },
|
||||
{ 0x04BF, 13 }, { 0x14BF, 13 }, { 0x0CBF, 13 }, { 0x1CBF, 13 },
|
||||
{ 0x02BF, 13 }, { 0x12BF, 13 }, { 0x0ABF, 13 }, { 0x1ABF, 13 },
|
||||
{ 0x06BF, 13 }, { 0x16BF, 13 }, { 0x0EBF, 13 }, { 0x1EBF, 13 },
|
||||
{ 0x01BF, 13 }, { 0x11BF, 13 }, { 0x09BF, 13 }, { 0x19BF, 13 },
|
||||
{ 0x05BF, 13 }, { 0x15BF, 13 }, { 0x0DBF, 13 }, { 0x1DBF, 13 },
|
||||
{ 0x03BF, 13 }, { 0x13BF, 13 }, { 0x0BBF, 13 }, { 0x1BBF, 13 },
|
||||
{ 0x07BF, 13 }, { 0x17BF, 13 }, { 0x0FBF, 13 }, { 0x1FBF, 13 },
|
||||
{ 0x007F, 14 }, { 0x207F, 14 }, { 0x107F, 14 }, { 0x307F, 14 },
|
||||
{ 0x087F, 14 }, { 0x287F, 14 }, { 0x187F, 14 }, { 0x387F, 14 },
|
||||
{ 0x047F, 14 }, { 0x247F, 14 }, { 0x147F, 14 }, { 0x0002, 3 },
|
||||
{ 0x0011, 5 }, { 0x0005, 5 }, { 0x0015, 5 }, { 0x0003, 6 },
|
||||
{ 0x003B, 6 }, { 0x0047, 8 }, { 0x00C7, 8 }, { 0x0017, 8 },
|
||||
{ 0x00D7, 8 }, { 0x0077, 8 }, { 0x010F, 9 }, { 0x004F, 9 },
|
||||
{ 0x01CF, 9 }, { 0x00AF, 9 }, { 0x016F, 9 },
|
||||
#else
|
||||
{0x0000, 3}, {0x0001, 3}, {0x0003, 3}, {0x0010, 5},
|
||||
{0x0012, 5}, {0x0013, 5}, {0x0016, 5}, {0x0017, 5},
|
||||
{0x0031, 6}, {0x0032, 6}, {0x0033, 6}, {0x0034, 6},
|
||||
{0x0035, 6}, {0x0036, 6}, {0x00E0, 8}, {0x00E1, 8},
|
||||
{0x00E4, 8}, {0x00E5, 8}, {0x00E6, 8}, {0x00E7, 8},
|
||||
{0x00E9, 8}, {0x00EA, 8}, {0x00EC, 8}, {0x00ED, 8},
|
||||
{0x00EF, 8}, {0x01E0, 9}, {0x01E2, 9}, {0x01E3, 9},
|
||||
{0x01E5, 9}, {0x01E6, 9}, {0x01E8, 9}, {0x01E9, 9},
|
||||
{0x01EB, 9}, {0x01EC, 9}, {0x01EE, 9}, {0x01EF, 9},
|
||||
{0x03E0, 10}, {0x03E1, 10}, {0x03E2, 10}, {0x03E3, 10},
|
||||
{0x03E4, 10}, {0x03E5, 10}, {0x03E6, 10}, {0x03E7, 10},
|
||||
{0x03E8, 10}, {0x03E9, 10}, {0x03EA, 10}, {0x03EB, 10},
|
||||
{0x03EC, 10}, {0x03ED, 10}, {0x03EE, 10}, {0x03EF, 10},
|
||||
{0x1F80, 13}, {0x1F81, 13}, {0x1F82, 13}, {0x1F83, 13},
|
||||
{0x1F84, 13}, {0x1F85, 13}, {0x1F86, 13}, {0x1F87, 13},
|
||||
{0x1F88, 13}, {0x1F89, 13}, {0x1F8A, 13}, {0x1F8B, 13},
|
||||
{0x1F8C, 13}, {0x1F8D, 13}, {0x1F8E, 13}, {0x1F8F, 13},
|
||||
{0x1F90, 13}, {0x1F91, 13}, {0x1F92, 13}, {0x1F93, 13},
|
||||
{0x1F94, 13}, {0x1F95, 13}, {0x1F96, 13}, {0x1F97, 13},
|
||||
{0x1F98, 13}, {0x1F99, 13}, {0x1F9A, 13}, {0x1F9B, 13},
|
||||
{0x1F9C, 13}, {0x1F9D, 13}, {0x1F9E, 13}, {0x1F9F, 13},
|
||||
{0x1FA0, 13}, {0x1FA1, 13}, {0x1FA2, 13}, {0x1FA3, 13},
|
||||
{0x1FA4, 13}, {0x1FA5, 13}, {0x1FA6, 13}, {0x1FA7, 13},
|
||||
{0x1FA8, 13}, {0x1FA9, 13}, {0x1FAA, 13}, {0x1FAB, 13},
|
||||
{0x1FAC, 13}, {0x1FAD, 13}, {0x1FAE, 13}, {0x1FAF, 13},
|
||||
{0x1FB0, 13}, {0x1FB1, 13}, {0x1FB2, 13}, {0x1FB3, 13},
|
||||
{0x1FB4, 13}, {0x1FB5, 13}, {0x1FB6, 13}, {0x1FB7, 13},
|
||||
{0x1FB8, 13}, {0x1FB9, 13}, {0x1FBA, 13}, {0x1FBB, 13},
|
||||
{0x1FBC, 13}, {0x1FBD, 13}, {0x1FBE, 13}, {0x1FBF, 13},
|
||||
{0x3F80, 14}, {0x3F81, 14}, {0x3F82, 14}, {0x3F83, 14},
|
||||
{0x3F84, 14}, {0x3F85, 14}, {0x3F86, 14}, {0x3F87, 14},
|
||||
{0x3F88, 14}, {0x3F89, 14}, {0x3F8A, 14}, {0x0002, 3},
|
||||
{0x0011, 5}, {0x0014, 5}, {0x0015, 5}, {0x0030, 6},
|
||||
{0x0037, 6}, {0x00E2, 8}, {0x00E3, 8}, {0x00E8, 8},
|
||||
{0x00EB, 8}, {0x00EE, 8}, {0x01E1, 9}, {0x01E4, 9},
|
||||
{0x01E7, 9}, {0x01EA, 9}, {0x01ED, 9}
|
||||
{ 0x0000, 3 }, { 0x0001, 3 }, { 0x0003, 3 }, { 0x0010, 5 },
|
||||
{ 0x0012, 5 }, { 0x0013, 5 }, { 0x0016, 5 }, { 0x0017, 5 },
|
||||
{ 0x0031, 6 }, { 0x0032, 6 }, { 0x0033, 6 }, { 0x0034, 6 },
|
||||
{ 0x0035, 6 }, { 0x0036, 6 }, { 0x00E0, 8 }, { 0x00E1, 8 },
|
||||
{ 0x00E4, 8 }, { 0x00E5, 8 }, { 0x00E6, 8 }, { 0x00E7, 8 },
|
||||
{ 0x00E9, 8 }, { 0x00EA, 8 }, { 0x00EC, 8 }, { 0x00ED, 8 },
|
||||
{ 0x00EF, 8 }, { 0x01E0, 9 }, { 0x01E2, 9 }, { 0x01E3, 9 },
|
||||
{ 0x01E5, 9 }, { 0x01E6, 9 }, { 0x01E8, 9 }, { 0x01E9, 9 },
|
||||
{ 0x01EB, 9 }, { 0x01EC, 9 }, { 0x01EE, 9 }, { 0x01EF, 9 },
|
||||
{ 0x03E0, 10 }, { 0x03E1, 10 }, { 0x03E2, 10 }, { 0x03E3, 10 },
|
||||
{ 0x03E4, 10 }, { 0x03E5, 10 }, { 0x03E6, 10 }, { 0x03E7, 10 },
|
||||
{ 0x03E8, 10 }, { 0x03E9, 10 }, { 0x03EA, 10 }, { 0x03EB, 10 },
|
||||
{ 0x03EC, 10 }, { 0x03ED, 10 }, { 0x03EE, 10 }, { 0x03EF, 10 },
|
||||
{ 0x1F80, 13 }, { 0x1F81, 13 }, { 0x1F82, 13 }, { 0x1F83, 13 },
|
||||
{ 0x1F84, 13 }, { 0x1F85, 13 }, { 0x1F86, 13 }, { 0x1F87, 13 },
|
||||
{ 0x1F88, 13 }, { 0x1F89, 13 }, { 0x1F8A, 13 }, { 0x1F8B, 13 },
|
||||
{ 0x1F8C, 13 }, { 0x1F8D, 13 }, { 0x1F8E, 13 }, { 0x1F8F, 13 },
|
||||
{ 0x1F90, 13 }, { 0x1F91, 13 }, { 0x1F92, 13 }, { 0x1F93, 13 },
|
||||
{ 0x1F94, 13 }, { 0x1F95, 13 }, { 0x1F96, 13 }, { 0x1F97, 13 },
|
||||
{ 0x1F98, 13 }, { 0x1F99, 13 }, { 0x1F9A, 13 }, { 0x1F9B, 13 },
|
||||
{ 0x1F9C, 13 }, { 0x1F9D, 13 }, { 0x1F9E, 13 }, { 0x1F9F, 13 },
|
||||
{ 0x1FA0, 13 }, { 0x1FA1, 13 }, { 0x1FA2, 13 }, { 0x1FA3, 13 },
|
||||
{ 0x1FA4, 13 }, { 0x1FA5, 13 }, { 0x1FA6, 13 }, { 0x1FA7, 13 },
|
||||
{ 0x1FA8, 13 }, { 0x1FA9, 13 }, { 0x1FAA, 13 }, { 0x1FAB, 13 },
|
||||
{ 0x1FAC, 13 }, { 0x1FAD, 13 }, { 0x1FAE, 13 }, { 0x1FAF, 13 },
|
||||
{ 0x1FB0, 13 }, { 0x1FB1, 13 }, { 0x1FB2, 13 }, { 0x1FB3, 13 },
|
||||
{ 0x1FB4, 13 }, { 0x1FB5, 13 }, { 0x1FB6, 13 }, { 0x1FB7, 13 },
|
||||
{ 0x1FB8, 13 }, { 0x1FB9, 13 }, { 0x1FBA, 13 }, { 0x1FBB, 13 },
|
||||
{ 0x1FBC, 13 }, { 0x1FBD, 13 }, { 0x1FBE, 13 }, { 0x1FBF, 13 },
|
||||
{ 0x3F80, 14 }, { 0x3F81, 14 }, { 0x3F82, 14 }, { 0x3F83, 14 },
|
||||
{ 0x3F84, 14 }, { 0x3F85, 14 }, { 0x3F86, 14 }, { 0x3F87, 14 },
|
||||
{ 0x3F88, 14 }, { 0x3F89, 14 }, { 0x3F8A, 14 }, { 0x0002, 3 },
|
||||
{ 0x0011, 5 }, { 0x0014, 5 }, { 0x0015, 5 }, { 0x0030, 6 },
|
||||
{ 0x0037, 6 }, { 0x00E2, 8 }, { 0x00E3, 8 }, { 0x00E8, 8 },
|
||||
{ 0x00EB, 8 }, { 0x00EE, 8 }, { 0x01E1, 9 }, { 0x01E4, 9 },
|
||||
{ 0x01E7, 9 }, { 0x01EA, 9 }, { 0x01ED, 9 },
|
||||
#endif
|
||||
};
|
||||
|
||||
static const uint8_t ir2_luma_table[256] = {
|
||||
0x80, 0x80, 0x84, 0x84, 0x7C, 0x7C, 0x7F, 0x85,
|
||||
0x81, 0x7B, 0x85, 0x7F, 0x7B, 0x81, 0x8C, 0x8C,
|
||||
0x74, 0x74, 0x83, 0x8D, 0x7D, 0x73, 0x8D, 0x83,
|
||||
0x73, 0x7D, 0x77, 0x89, 0x89, 0x77, 0x89, 0x77,
|
||||
0x77, 0x89, 0x8C, 0x95, 0x74, 0x6B, 0x95, 0x8C,
|
||||
0x6B, 0x74, 0x7C, 0x90, 0x84, 0x70, 0x90, 0x7C,
|
||||
0x70, 0x84, 0x96, 0x96, 0x6A, 0x6A, 0x82, 0x98,
|
||||
0x7E, 0x68, 0x98, 0x82, 0x68, 0x7E, 0x97, 0xA2,
|
||||
0x69, 0x5E, 0xA2, 0x97, 0x5E, 0x69, 0xA2, 0xA2,
|
||||
0x5E, 0x5E, 0x8B, 0xA3, 0x75, 0x5D, 0xA3, 0x8B,
|
||||
0x5D, 0x75, 0x71, 0x95, 0x8F, 0x6B, 0x95, 0x71,
|
||||
0x6B, 0x8F, 0x78, 0x9D, 0x88, 0x63, 0x9D, 0x78,
|
||||
0x63, 0x88, 0x7F, 0xA7, 0x81, 0x59, 0xA7, 0x7F,
|
||||
0x59, 0x81, 0xA4, 0xB1, 0x5C, 0x4F, 0xB1, 0xA4,
|
||||
0x4F, 0x5C, 0x96, 0xB1, 0x6A, 0x4F, 0xB1, 0x96,
|
||||
0x4F, 0x6A, 0xB2, 0xB2, 0x4E, 0x4E, 0x65, 0x9B,
|
||||
0x9B, 0x65, 0x9B, 0x65, 0x65, 0x9B, 0x89, 0xB4,
|
||||
0x77, 0x4C, 0xB4, 0x89, 0x4C, 0x77, 0x6A, 0xA3,
|
||||
0x96, 0x5D, 0xA3, 0x6A, 0x5D, 0x96, 0x73, 0xAC,
|
||||
0x8D, 0x54, 0xAC, 0x73, 0x54, 0x8D, 0xB4, 0xC3,
|
||||
0x4C, 0x3D, 0xC3, 0xB4, 0x3D, 0x4C, 0xA4, 0xC3,
|
||||
0x5C, 0x3D, 0xC3, 0xA4, 0x3D, 0x5C, 0xC4, 0xC4,
|
||||
0x3C, 0x3C, 0x96, 0xC6, 0x6A, 0x3A, 0xC6, 0x96,
|
||||
0x3A, 0x6A, 0x7C, 0xBA, 0x84, 0x46, 0xBA, 0x7C,
|
||||
0x46, 0x84, 0x5B, 0xAB, 0xA5, 0x55, 0xAB, 0x5B,
|
||||
0x55, 0xA5, 0x63, 0xB4, 0x9D, 0x4C, 0xB4, 0x63,
|
||||
0x4C, 0x9D, 0x86, 0xCA, 0x7A, 0x36, 0xCA, 0x86,
|
||||
0x36, 0x7A, 0xB6, 0xD7, 0x4A, 0x29, 0xD7, 0xB6,
|
||||
0x29, 0x4A, 0xC8, 0xD7, 0x38, 0x29, 0xD7, 0xC8,
|
||||
0x29, 0x38, 0xA4, 0xD8, 0x5C, 0x28, 0xD8, 0xA4,
|
||||
0x28, 0x5C, 0x6C, 0xC1, 0x94, 0x3F, 0xC1, 0x6C,
|
||||
0x3F, 0x94, 0xD9, 0xD9, 0x27, 0x27, 0x80, 0x80
|
||||
static const uint8_t ir2_delta_table[4][256] = {
|
||||
{ 0x80, 0x80, 0x84, 0x84, 0x7C, 0x7C, 0x7F, 0x85,
|
||||
0x81, 0x7B, 0x85, 0x7F, 0x7B, 0x81, 0x8C, 0x8C,
|
||||
0x74, 0x74, 0x83, 0x8D, 0x7D, 0x73, 0x8D, 0x83,
|
||||
0x73, 0x7D, 0x77, 0x89, 0x89, 0x77, 0x89, 0x77,
|
||||
0x77, 0x89, 0x8C, 0x95, 0x74, 0x6B, 0x95, 0x8C,
|
||||
0x6B, 0x74, 0x7C, 0x90, 0x84, 0x70, 0x90, 0x7C,
|
||||
0x70, 0x84, 0x96, 0x96, 0x6A, 0x6A, 0x82, 0x98,
|
||||
0x7E, 0x68, 0x98, 0x82, 0x68, 0x7E, 0x97, 0xA2,
|
||||
0x69, 0x5E, 0xA2, 0x97, 0x5E, 0x69, 0xA2, 0xA2,
|
||||
0x5E, 0x5E, 0x8B, 0xA3, 0x75, 0x5D, 0xA3, 0x8B,
|
||||
0x5D, 0x75, 0x71, 0x95, 0x8F, 0x6B, 0x95, 0x71,
|
||||
0x6B, 0x8F, 0x78, 0x9D, 0x88, 0x63, 0x9D, 0x78,
|
||||
0x63, 0x88, 0x7F, 0xA7, 0x81, 0x59, 0xA7, 0x7F,
|
||||
0x59, 0x81, 0xA4, 0xB1, 0x5C, 0x4F, 0xB1, 0xA4,
|
||||
0x4F, 0x5C, 0x96, 0xB1, 0x6A, 0x4F, 0xB1, 0x96,
|
||||
0x4F, 0x6A, 0xB2, 0xB2, 0x4E, 0x4E, 0x65, 0x9B,
|
||||
0x9B, 0x65, 0x9B, 0x65, 0x65, 0x9B, 0x89, 0xB4,
|
||||
0x77, 0x4C, 0xB4, 0x89, 0x4C, 0x77, 0x6A, 0xA3,
|
||||
0x96, 0x5D, 0xA3, 0x6A, 0x5D, 0x96, 0x73, 0xAC,
|
||||
0x8D, 0x54, 0xAC, 0x73, 0x54, 0x8D, 0xB4, 0xC3,
|
||||
0x4C, 0x3D, 0xC3, 0xB4, 0x3D, 0x4C, 0xA4, 0xC3,
|
||||
0x5C, 0x3D, 0xC3, 0xA4, 0x3D, 0x5C, 0xC4, 0xC4,
|
||||
0x3C, 0x3C, 0x96, 0xC6, 0x6A, 0x3A, 0xC6, 0x96,
|
||||
0x3A, 0x6A, 0x7C, 0xBA, 0x84, 0x46, 0xBA, 0x7C,
|
||||
0x46, 0x84, 0x5B, 0xAB, 0xA5, 0x55, 0xAB, 0x5B,
|
||||
0x55, 0xA5, 0x63, 0xB4, 0x9D, 0x4C, 0xB4, 0x63,
|
||||
0x4C, 0x9D, 0x86, 0xCA, 0x7A, 0x36, 0xCA, 0x86,
|
||||
0x36, 0x7A, 0xB6, 0xD7, 0x4A, 0x29, 0xD7, 0xB6,
|
||||
0x29, 0x4A, 0xC8, 0xD7, 0x38, 0x29, 0xD7, 0xC8,
|
||||
0x29, 0x38, 0xA4, 0xD8, 0x5C, 0x28, 0xD8, 0xA4,
|
||||
0x28, 0x5C, 0x6C, 0xC1, 0x94, 0x3F, 0xC1, 0x6C,
|
||||
0x3F, 0x94, 0xD9, 0xD9, 0x27, 0x27, 0x80, 0x80, },
|
||||
{ 0x80, 0x80, 0x85, 0x85, 0x7B, 0x7B, 0x7E, 0x87,
|
||||
0x82, 0x79, 0x87, 0x7E, 0x79, 0x82, 0x8F, 0x8F,
|
||||
0x71, 0x71, 0x84, 0x8F, 0x7C, 0x71, 0x8F, 0x84,
|
||||
0x71, 0x7C, 0x75, 0x8B, 0x8B, 0x75, 0x8B, 0x75,
|
||||
0x75, 0x8B, 0x8E, 0x9A, 0x72, 0x66, 0x9A, 0x8E,
|
||||
0x66, 0x72, 0x7B, 0x93, 0x85, 0x6D, 0x93, 0x7B,
|
||||
0x6D, 0x85, 0x9B, 0x9B, 0x65, 0x65, 0x82, 0x9D,
|
||||
0x7E, 0x63, 0x9D, 0x82, 0x63, 0x7E, 0x9B, 0xA8,
|
||||
0x65, 0x58, 0xA8, 0x9B, 0x58, 0x65, 0xA9, 0xA9,
|
||||
0x57, 0x57, 0x8D, 0xAA, 0x73, 0x56, 0xAA, 0x8D,
|
||||
0x56, 0x73, 0x6E, 0x99, 0x92, 0x67, 0x99, 0x6E,
|
||||
0x67, 0x92, 0x76, 0xA2, 0x8A, 0x5E, 0xA2, 0x76,
|
||||
0x5E, 0x8A, 0x7F, 0xAF, 0x81, 0x51, 0xAF, 0x7F,
|
||||
0x51, 0x81, 0xAB, 0xBA, 0x55, 0x46, 0xBA, 0xAB,
|
||||
0x46, 0x55, 0x9A, 0xBB, 0x66, 0x45, 0xBB, 0x9A,
|
||||
0x45, 0x66, 0xBB, 0xBB, 0x45, 0x45, 0x60, 0xA0,
|
||||
0xA0, 0x60, 0xA0, 0x60, 0x60, 0xA0, 0x8B, 0xBE,
|
||||
0x75, 0x42, 0xBE, 0x8B, 0x42, 0x75, 0x66, 0xAA,
|
||||
0x9A, 0x56, 0xAA, 0x66, 0x56, 0x9A, 0x70, 0xB5,
|
||||
0x90, 0x4B, 0xB5, 0x70, 0x4B, 0x90, 0xBE, 0xCF,
|
||||
0x42, 0x31, 0xCF, 0xBE, 0x31, 0x42, 0xAB, 0xD0,
|
||||
0x55, 0x30, 0xD0, 0xAB, 0x30, 0x55, 0xD1, 0xD1,
|
||||
0x2F, 0x2F, 0x9A, 0xD3, 0x66, 0x2D, 0xD3, 0x9A,
|
||||
0x2D, 0x66, 0x7B, 0xC5, 0x85, 0x3B, 0xC5, 0x7B,
|
||||
0x3B, 0x85, 0x54, 0xB4, 0xAC, 0x4C, 0xB4, 0x54,
|
||||
0x4C, 0xAC, 0x5E, 0xBE, 0xA2, 0x42, 0xBE, 0x5E,
|
||||
0x42, 0xA2, 0x87, 0xD8, 0x79, 0x28, 0xD8, 0x87,
|
||||
0x28, 0x79, 0xC0, 0xE8, 0x40, 0x18, 0xE8, 0xC0,
|
||||
0x18, 0x40, 0xD5, 0xE8, 0x2B, 0x18, 0xE8, 0xD5,
|
||||
0x18, 0x2B, 0xAB, 0xE9, 0x55, 0x17, 0xE9, 0xAB,
|
||||
0x17, 0x55, 0x68, 0xCD, 0x98, 0x33, 0xCD, 0x68,
|
||||
0x33, 0x98, 0xEA, 0xEA, 0x16, 0x16, 0x80, 0x80, },
|
||||
{ 0x80, 0x80, 0x86, 0x86, 0x7A, 0x7A, 0x7E, 0x88,
|
||||
0x82, 0x78, 0x88, 0x7E, 0x78, 0x82, 0x92, 0x92,
|
||||
0x6E, 0x6E, 0x85, 0x92, 0x7B, 0x6E, 0x92, 0x85,
|
||||
0x6E, 0x7B, 0x73, 0x8D, 0x8D, 0x73, 0x8D, 0x73,
|
||||
0x73, 0x8D, 0x91, 0x9E, 0x6F, 0x62, 0x9E, 0x91,
|
||||
0x62, 0x6F, 0x79, 0x97, 0x87, 0x69, 0x97, 0x79,
|
||||
0x69, 0x87, 0xA0, 0xA0, 0x60, 0x60, 0x83, 0xA2,
|
||||
0x7D, 0x5E, 0xA2, 0x83, 0x5E, 0x7D, 0xA0, 0xB0,
|
||||
0x60, 0x50, 0xB0, 0xA0, 0x50, 0x60, 0xB1, 0xB1,
|
||||
0x4F, 0x4F, 0x8F, 0xB2, 0x71, 0x4E, 0xB2, 0x8F,
|
||||
0x4E, 0x71, 0x6B, 0x9E, 0x95, 0x62, 0x9E, 0x6B,
|
||||
0x62, 0x95, 0x74, 0xA9, 0x8C, 0x57, 0xA9, 0x74,
|
||||
0x57, 0x8C, 0x7F, 0xB8, 0x81, 0x48, 0xB8, 0x7F,
|
||||
0x48, 0x81, 0xB4, 0xC5, 0x4C, 0x3B, 0xC5, 0xB4,
|
||||
0x3B, 0x4C, 0x9F, 0xC6, 0x61, 0x3A, 0xC6, 0x9F,
|
||||
0x3A, 0x61, 0xC6, 0xC6, 0x3A, 0x3A, 0x59, 0xA7,
|
||||
0xA7, 0x59, 0xA7, 0x59, 0x59, 0xA7, 0x8D, 0xCA,
|
||||
0x73, 0x36, 0xCA, 0x8D, 0x36, 0x73, 0x61, 0xB2,
|
||||
0x9F, 0x4E, 0xB2, 0x61, 0x4E, 0x9F, 0x6D, 0xBF,
|
||||
0x93, 0x41, 0xBF, 0x6D, 0x41, 0x93, 0xCA, 0xDF,
|
||||
0x36, 0x21, 0xDF, 0xCA, 0x21, 0x36, 0xB3, 0xDF,
|
||||
0x4D, 0x21, 0xDF, 0xB3, 0x21, 0x4D, 0xE1, 0xE1,
|
||||
0x1F, 0x1F, 0x9F, 0xE3, 0x61, 0x1D, 0xE3, 0x9F,
|
||||
0x1D, 0x61, 0x7A, 0xD3, 0x86, 0x2D, 0xD3, 0x7A,
|
||||
0x2D, 0x86, 0x4C, 0xBE, 0xB4, 0x42, 0xBE, 0x4C,
|
||||
0x42, 0xB4, 0x57, 0xCA, 0xA9, 0x36, 0xCA, 0x57,
|
||||
0x36, 0xA9, 0x88, 0xE9, 0x78, 0x17, 0xE9, 0x88,
|
||||
0x17, 0x78, 0xCC, 0xFB, 0x34, 0x05, 0xFB, 0xCC,
|
||||
0x05, 0x34, 0xE6, 0xFB, 0x1A, 0x05, 0xFB, 0xE6,
|
||||
0x05, 0x1A, 0xB4, 0xFD, 0x4C, 0x03, 0xFD, 0xB4,
|
||||
0x03, 0x4C, 0x63, 0xDC, 0x9D, 0x24, 0xDC, 0x63,
|
||||
0x24, 0x9D, 0xFE, 0xFE, 0x02, 0x02, 0x80, 0x80, },
|
||||
{ 0x80, 0x80, 0x87, 0x87, 0x79, 0x79, 0x7E, 0x89,
|
||||
0x82, 0x77, 0x89, 0x7E, 0x77, 0x82, 0x95, 0x95,
|
||||
0x6B, 0x6B, 0x86, 0x96, 0x7A, 0x6A, 0x96, 0x86,
|
||||
0x6A, 0x7A, 0x70, 0x90, 0x90, 0x70, 0x90, 0x70,
|
||||
0x70, 0x90, 0x94, 0xA4, 0x6C, 0x5C, 0xA4, 0x94,
|
||||
0x5C, 0x6C, 0x78, 0x9B, 0x88, 0x65, 0x9B, 0x78,
|
||||
0x65, 0x88, 0xA6, 0xA6, 0x5A, 0x5A, 0x83, 0xA9,
|
||||
0x7D, 0x57, 0xA9, 0x83, 0x57, 0x7D, 0xA6, 0xB9,
|
||||
0x5A, 0x47, 0xB9, 0xA6, 0x47, 0x5A, 0xBA, 0xBA,
|
||||
0x46, 0x46, 0x92, 0xBC, 0x6E, 0x44, 0xBC, 0x92,
|
||||
0x44, 0x6E, 0x67, 0xA3, 0x99, 0x5D, 0xA3, 0x67,
|
||||
0x5D, 0x99, 0x72, 0xB0, 0x8E, 0x50, 0xB0, 0x72,
|
||||
0x50, 0x8E, 0x7F, 0xC3, 0x81, 0x3D, 0xC3, 0x7F,
|
||||
0x3D, 0x81, 0xBE, 0xD2, 0x42, 0x2E, 0xD2, 0xBE,
|
||||
0x2E, 0x42, 0xA5, 0xD4, 0x5B, 0x2C, 0xD4, 0xA5,
|
||||
0x2C, 0x5B, 0xD4, 0xD4, 0x2C, 0x2C, 0x52, 0xAE,
|
||||
0xAE, 0x52, 0xAE, 0x52, 0x52, 0xAE, 0x8F, 0xD8,
|
||||
0x71, 0x28, 0xD8, 0x8F, 0x28, 0x71, 0x5B, 0xBB,
|
||||
0xA5, 0x45, 0xBB, 0x5B, 0x45, 0xA5, 0x69, 0xCB,
|
||||
0x97, 0x35, 0xCB, 0x69, 0x35, 0x97, 0xD8, 0xF0,
|
||||
0x28, 0x10, 0xF0, 0xD8, 0x10, 0x28, 0xBD, 0xF1,
|
||||
0x43, 0x0F, 0xF1, 0xBD, 0x0F, 0x43, 0xF3, 0xF3,
|
||||
0x0D, 0x0D, 0xA5, 0xF6, 0x5B, 0x0A, 0xF6, 0xA5,
|
||||
0x0A, 0x5B, 0x78, 0xE2, 0x88, 0x1E, 0xE2, 0x78,
|
||||
0x1E, 0x88, 0x42, 0xC9, 0xBE, 0x37, 0xC9, 0x42,
|
||||
0x37, 0xBE, 0x4F, 0xD8, 0xB1, 0x28, 0xD8, 0x4F,
|
||||
0x28, 0xB1, 0x8A, 0xFD, 0x76, 0x03, 0xFD, 0x8A,
|
||||
0x03, 0x76, 0xDB, 0xFF, 0x25, 0x01, 0xFF, 0xDB,
|
||||
0x01, 0x25, 0xF9, 0xFF, 0x07, 0x01, 0xFF, 0xF9,
|
||||
0x01, 0x07, 0xBE, 0xFF, 0x42, 0x01, 0xFF, 0xBE,
|
||||
0x01, 0x42, 0x5E, 0xED, 0xA2, 0x13, 0xED, 0x5E,
|
||||
0x13, 0xA2, 0xFF, 0xFF, 0x01, 0x01, 0x80, 0x80, },
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_INDEO2DATA_H */
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "avcodec.h"
|
||||
#include "bytestream.h"
|
||||
#include "hpeldsp.h"
|
||||
@@ -949,7 +950,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s, AVFrame *frame)
|
||||
}
|
||||
}
|
||||
if (bytestream2_get_bytes_left(&s->stream_ptr) > 1) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
av_log(s->avctx, AV_LOG_DEBUG,
|
||||
"decode finished with %d bytes left over\n",
|
||||
bytestream2_get_bytes_left(&s->stream_ptr));
|
||||
}
|
||||
@@ -987,12 +988,15 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
||||
AVFrame *frame = data;
|
||||
int ret;
|
||||
|
||||
if (buf_size < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* decoding map contains 4 bits of information per 8x8 block */
|
||||
s->decoding_map_size = avctx->width * avctx->height / (8 * 8 * 2);
|
||||
s->decoding_map_size = AV_RL16(avpkt->data);
|
||||
|
||||
/* compressed buffer needs to be large enough to at least hold an entire
|
||||
* decoding map */
|
||||
if (buf_size < s->decoding_map_size)
|
||||
if (buf_size < s->decoding_map_size + 2)
|
||||
return buf_size;
|
||||
|
||||
if (av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, NULL)) {
|
||||
@@ -1000,8 +1004,8 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
||||
av_frame_unref(s->second_last_frame);
|
||||
}
|
||||
|
||||
s->decoding_map = buf;
|
||||
bytestream2_init(&s->stream_ptr, buf + s->decoding_map_size,
|
||||
s->decoding_map = buf + 2;
|
||||
bytestream2_init(&s->stream_ptr, buf + 2 + s->decoding_map_size,
|
||||
buf_size - s->decoding_map_size);
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
/**
|
||||
* Table of number of bits a motion vector component needs.
|
||||
*/
|
||||
static uint8_t mv_penalty[MAX_FCODE+1][MAX_MV*2+1];
|
||||
static uint8_t mv_penalty[MAX_FCODE+1][MAX_DMV*2+1];
|
||||
|
||||
/**
|
||||
* Minimal fcode that a motion vector component would need.
|
||||
@@ -676,7 +676,7 @@ static av_cold void init_mv_penalty_and_fcode(MpegEncContext *s)
|
||||
int mv;
|
||||
|
||||
for(f_code=1; f_code<=MAX_FCODE; f_code++){
|
||||
for(mv=-MAX_MV; mv<=MAX_MV; mv++){
|
||||
for(mv=-MAX_DMV; mv<=MAX_DMV; mv++){
|
||||
int len;
|
||||
|
||||
if(mv==0) len= ff_mvtab[0][1];
|
||||
@@ -697,7 +697,7 @@ static av_cold void init_mv_penalty_and_fcode(MpegEncContext *s)
|
||||
}
|
||||
}
|
||||
|
||||
mv_penalty[f_code][mv+MAX_MV]= len;
|
||||
mv_penalty[f_code][mv+MAX_DMV]= len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,46 @@
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* **********************************************************************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
* This source code incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2007, Callum Lerwick <seg@haxxed.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* JPEG2000 image encoder
|
||||
* @file
|
||||
|
||||
@@ -1081,6 +1081,10 @@ static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
|
||||
ff_mqc_initdec(&t1->mqc, cblk->data);
|
||||
|
||||
while (passno--) {
|
||||
if (bpno < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "bpno became negative\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
switch(pass_t) {
|
||||
case 0:
|
||||
decode_sigpass(t1, width, height, bpno + 1, bandpos,
|
||||
@@ -1241,11 +1245,15 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
||||
if (tile->codsty[0].mct)
|
||||
mct_decode(s, tile);
|
||||
|
||||
if (s->cdef[0] < 0) {
|
||||
for (x = 0; x < s->ncomponents; x++)
|
||||
s->cdef[x] = x + 1;
|
||||
if ((s->ncomponents & 1) == 0)
|
||||
s->cdef[s->ncomponents-1] = 0;
|
||||
for (x = 0; x < s->ncomponents; x++) {
|
||||
if (s->cdef[x] < 0) {
|
||||
for (x = 0; x < s->ncomponents; x++) {
|
||||
s->cdef[x] = x + 1;
|
||||
}
|
||||
if ((s->ncomponents & 1) == 0)
|
||||
s->cdef[s->ncomponents-1] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (s->precision <= 8) {
|
||||
|
||||
@@ -540,6 +540,9 @@ int ff_jpeg2000_dwt_init(DWTContext *s, uint16_t border[2][2],
|
||||
|
||||
int ff_dwt_encode(DWTContext *s, void *t)
|
||||
{
|
||||
if (s->ndeclevels == 0)
|
||||
return 0;
|
||||
|
||||
switch(s->type){
|
||||
case FF_DWT97:
|
||||
dwt_encode97_float(s, t); break;
|
||||
@@ -555,6 +558,9 @@ int ff_dwt_encode(DWTContext *s, void *t)
|
||||
|
||||
int ff_dwt_decode(DWTContext *s, void *t)
|
||||
{
|
||||
if (s->ndeclevels == 0)
|
||||
return 0;
|
||||
|
||||
switch (s->type) {
|
||||
case FF_DWT97:
|
||||
dwt_decode97_float(s, t);
|
||||
|
||||
@@ -222,9 +222,19 @@ static int utvideo_decode_frame(AVCodecContext *avctx, void *data,
|
||||
pic->data[0] = utv->buffer + utv->buf_size + pic->linesize[0];
|
||||
break;
|
||||
}
|
||||
pic->width = w;
|
||||
pic->height = h;
|
||||
pic->format = avctx->pix_fmt;
|
||||
|
||||
if (avctx->refcounted_frames) {
|
||||
int ret = av_frame_ref((AVFrame*)data, pic);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
av_frame_move_ref((AVFrame*)data, pic);
|
||||
}
|
||||
|
||||
*got_frame = 1;
|
||||
av_frame_move_ref((AVFrame*)data, pic);
|
||||
|
||||
return avpkt->size;
|
||||
}
|
||||
|
||||
+52
-26
@@ -606,7 +606,8 @@ unk_pixfmt:
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len);
|
||||
}
|
||||
|
||||
if (s->rgb && !s->lossless && !s->ls) {
|
||||
if ((s->rgb && !s->lossless && !s->ls) ||
|
||||
(!s->rgb && s->ls && s->nb_components > 1)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Unsupported coding and pixel format combination\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
@@ -971,7 +972,7 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
return -1;
|
||||
|
||||
left[i] = buffer[mb_x][i] =
|
||||
mask & (pred + (dc << point_transform));
|
||||
mask & (pred + (dc * (1 << point_transform)));
|
||||
}
|
||||
|
||||
if (s->restart_interval && !--s->restart_count) {
|
||||
@@ -1219,7 +1220,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
|
||||
int mb_bitmask_size,
|
||||
const AVFrame *reference)
|
||||
{
|
||||
int i, mb_x, mb_y;
|
||||
int i, mb_x, mb_y, chroma_h_shift, chroma_v_shift, chroma_width, chroma_height;
|
||||
uint8_t *data[MAX_COMPONENTS];
|
||||
const uint8_t *reference_data[MAX_COMPONENTS];
|
||||
int linesize[MAX_COMPONENTS];
|
||||
@@ -1236,6 +1237,11 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
|
||||
|
||||
s->restart_count = 0;
|
||||
|
||||
av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &chroma_h_shift,
|
||||
&chroma_v_shift);
|
||||
chroma_width = FF_CEIL_RSHIFT(s->width, chroma_h_shift);
|
||||
chroma_height = FF_CEIL_RSHIFT(s->height, chroma_v_shift);
|
||||
|
||||
for (i = 0; i < nb_components; i++) {
|
||||
int c = s->comp_index[i];
|
||||
data[c] = s->picture_ptr->data[c];
|
||||
@@ -1272,8 +1278,8 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
|
||||
|
||||
if (s->interlaced && s->bottom_field)
|
||||
block_offset += linesize[c] >> 1;
|
||||
if ( 8*(h * mb_x + x) < s->width
|
||||
&& 8*(v * mb_y + y) < s->height) {
|
||||
if ( 8*(h * mb_x + x) < ((c == 1) || (c == 2) ? chroma_width : s->width)
|
||||
&& 8*(v * mb_y + y) < ((c == 1) || (c == 2) ? chroma_height : s->height)) {
|
||||
ptr = data[c] + block_offset;
|
||||
} else
|
||||
ptr = NULL;
|
||||
@@ -1336,11 +1342,7 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
|
||||
int mb_x, mb_y;
|
||||
int EOBRUN = 0;
|
||||
int c = s->comp_index[0];
|
||||
uint8_t *data = s->picture_ptr->data[c];
|
||||
int linesize = s->linesize[c];
|
||||
int last_scan = 0;
|
||||
int16_t *quant_matrix = s->quant_matrixes[s->quant_sindex[0]];
|
||||
int bytes_per_pixel = 1 + (s->bits > 8);
|
||||
|
||||
av_assert0(ss>=0 && Ah>=0 && Al>=0);
|
||||
if (se < ss || se > 63) {
|
||||
@@ -1348,20 +1350,13 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (!Al) {
|
||||
// s->coefs_finished is a bitmask for coefficients coded
|
||||
// ss and se are parameters telling start and end coefficients
|
||||
s->coefs_finished[c] |= (2ULL << se) - (1ULL << ss);
|
||||
last_scan = !~s->coefs_finished[c];
|
||||
}
|
||||
|
||||
if (s->interlaced && s->bottom_field)
|
||||
data += linesize >> 1;
|
||||
// s->coefs_finished is a bitmask for coefficients coded
|
||||
// ss and se are parameters telling start and end coefficients
|
||||
s->coefs_finished[c] |= (2ULL << se) - (1ULL << ss);
|
||||
|
||||
s->restart_count = 0;
|
||||
|
||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
||||
uint8_t *ptr = data + (mb_y * linesize * 8 >> s->avctx->lowres);
|
||||
int block_idx = mb_y * s->block_stride[c];
|
||||
int16_t (*block)[64] = &s->blocks[c][block_idx];
|
||||
uint8_t *last_nnz = &s->last_nnz[c][block_idx];
|
||||
@@ -1382,12 +1377,6 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (last_scan) {
|
||||
s->idsp.idct_put(ptr, linesize, *block);
|
||||
if (s->bits & 7)
|
||||
shift_output(s, ptr, linesize);
|
||||
ptr += bytes_per_pixel*8 >> s->avctx->lowres;
|
||||
}
|
||||
if (handle_rstn(s, 0))
|
||||
EOBRUN = 0;
|
||||
}
|
||||
@@ -1395,6 +1384,41 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mjpeg_idct_scan_progressive_ac(MJpegDecodeContext *s)
|
||||
{
|
||||
int mb_x, mb_y;
|
||||
int c;
|
||||
const int bytes_per_pixel = 1 + (s->bits > 8);
|
||||
const int block_size = s->lossless ? 1 : 8;
|
||||
|
||||
for (c = 0; c < s->nb_components; c++) {
|
||||
uint8_t *data = s->picture_ptr->data[c];
|
||||
int linesize = s->linesize[c];
|
||||
int h = s->h_max / s->h_count[c];
|
||||
int v = s->v_max / s->v_count[c];
|
||||
int mb_width = (s->width + h * block_size - 1) / (h * block_size);
|
||||
int mb_height = (s->height + v * block_size - 1) / (v * block_size);
|
||||
|
||||
if (~s->coefs_finished[c])
|
||||
av_log(s->avctx, AV_LOG_WARNING, "component %d is incomplete\n", c);
|
||||
|
||||
if (s->interlaced && s->bottom_field)
|
||||
data += linesize >> 1;
|
||||
|
||||
for (mb_y = 0; mb_y < mb_height; mb_y++) {
|
||||
uint8_t *ptr = data + (mb_y * linesize * 8 >> s->avctx->lowres);
|
||||
int block_idx = mb_y * s->block_stride[c];
|
||||
int16_t (*block)[64] = &s->blocks[c][block_idx];
|
||||
for (mb_x = 0; mb_x < mb_width; mb_x++, block++) {
|
||||
s->idsp.idct_put(ptr, linesize, *block);
|
||||
if (s->bits & 7)
|
||||
shift_output(s, ptr, linesize);
|
||||
ptr += bytes_per_pixel*8 >> s->avctx->lowres;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
|
||||
int mb_bitmask_size, const AVFrame *reference)
|
||||
{
|
||||
@@ -1933,7 +1957,7 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
|
||||
while (b < t) {
|
||||
uint8_t x = src[b++];
|
||||
put_bits(&pb, 8, x);
|
||||
if (x == 0xFF) {
|
||||
if (x == 0xFF && b < t) {
|
||||
x = src[b++];
|
||||
if (x & 0x80) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Invalid escape sequence\n");
|
||||
@@ -2077,6 +2101,8 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
break;
|
||||
case EOI:
|
||||
eoi_parser:
|
||||
if (avctx->skip_frame != AVDISCARD_ALL && s->progressive && s->cur_scan && s->got_picture)
|
||||
mjpeg_idct_scan_progressive_ac(s);
|
||||
s->cur_scan = 0;
|
||||
if (!s->got_picture) {
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
|
||||
@@ -117,14 +117,24 @@ static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p)
|
||||
uint8_t *ptr;
|
||||
|
||||
if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0) {
|
||||
AVRational sar = avctx->sample_aspect_ratio;
|
||||
|
||||
if (sar.num > 65535 || sar.den > 65535) {
|
||||
if (!av_reduce(&sar.num, &sar.den, avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den, 65535))
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"Cannot store exact aspect ratio %d:%d\n",
|
||||
avctx->sample_aspect_ratio.num,
|
||||
avctx->sample_aspect_ratio.den);
|
||||
}
|
||||
|
||||
/* JFIF header */
|
||||
put_marker(p, APP0);
|
||||
put_bits(p, 16, 16);
|
||||
avpriv_put_string(p, "JFIF", 1); /* this puts the trailing zero-byte too */
|
||||
put_bits(p, 16, 0x0102); /* v 1.02 */
|
||||
put_bits(p, 8, 0); /* units type: 0 - aspect ratio */
|
||||
put_bits(p, 16, avctx->sample_aspect_ratio.num);
|
||||
put_bits(p, 16, avctx->sample_aspect_ratio.den);
|
||||
put_bits(p, 16, sar.num);
|
||||
put_bits(p, 16, sar.den);
|
||||
put_bits(p, 8, 0); /* thumbnail width */
|
||||
put_bits(p, 8, 0); /* thumbnail height */
|
||||
}
|
||||
|
||||
@@ -906,7 +906,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
|
||||
c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
|
||||
c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp);
|
||||
c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp);
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV;
|
||||
|
||||
get_limits(s, 16*mb_x, 16*mb_y);
|
||||
c->skip=0;
|
||||
@@ -1082,7 +1082,7 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s,
|
||||
av_assert0(s->quarter_sample==0 || s->quarter_sample==1);
|
||||
|
||||
c->pre_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_pre_cmp);
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV;
|
||||
|
||||
get_limits(s, 16*mb_x, 16*mb_y);
|
||||
c->skip=0;
|
||||
@@ -1131,7 +1131,7 @@ static int estimate_motion_b(MpegEncContext *s, int mb_x, int mb_y,
|
||||
const int shift= 1+s->quarter_sample;
|
||||
const int mot_stride = s->mb_stride;
|
||||
const int mot_xy = mb_y*mot_stride + mb_x;
|
||||
uint8_t * const mv_penalty= c->mv_penalty[f_code] + MAX_MV;
|
||||
uint8_t * const mv_penalty= c->mv_penalty[f_code] + MAX_DMV;
|
||||
int mv_scale;
|
||||
|
||||
c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
|
||||
@@ -1205,8 +1205,8 @@ static inline int check_bidir_mv(MpegEncContext * s,
|
||||
//FIXME better f_code prediction (max mv & distance)
|
||||
//FIXME pointers
|
||||
MotionEstContext * const c= &s->me;
|
||||
uint8_t * const mv_penalty_f= c->mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame
|
||||
uint8_t * const mv_penalty_b= c->mv_penalty[s->b_code] + MAX_MV; // f_code of the prev frame
|
||||
uint8_t * const mv_penalty_f= c->mv_penalty[s->f_code] + MAX_DMV; // f_code of the prev frame
|
||||
uint8_t * const mv_penalty_b= c->mv_penalty[s->b_code] + MAX_DMV; // f_code of the prev frame
|
||||
int stride= c->stride;
|
||||
uint8_t *dest_y = c->scratchpad;
|
||||
uint8_t *ptr;
|
||||
@@ -1419,7 +1419,7 @@ static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y)
|
||||
int mx, my, xmin, xmax, ymin, ymax;
|
||||
int16_t (*mv_table)[2]= s->b_direct_mv_table;
|
||||
|
||||
c->current_mv_penalty= c->mv_penalty[1] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[1] + MAX_DMV;
|
||||
ymin= xmin=(-32)>>shift;
|
||||
ymax= xmax= 31>>shift;
|
||||
|
||||
@@ -1555,11 +1555,11 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
|
||||
if(s->flags & CODEC_FLAG_INTERLACED_ME){
|
||||
//FIXME mb type penalty
|
||||
c->skip=0;
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV;
|
||||
fimin= interlaced_search(s, 0,
|
||||
s->b_field_mv_table[0], s->b_field_select_table[0],
|
||||
s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1], 0);
|
||||
c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_DMV;
|
||||
bimin= interlaced_search(s, 2,
|
||||
s->b_field_mv_table[1], s->b_field_select_table[1],
|
||||
s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 0);
|
||||
|
||||
@@ -52,7 +52,7 @@ static const uint8_t svcd_scan_offset_placeholder[] = {
|
||||
0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
};
|
||||
|
||||
static uint8_t mv_penalty[MAX_FCODE + 1][MAX_MV * 2 + 1];
|
||||
static uint8_t mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
|
||||
static uint8_t fcode_tab[MAX_MV * 2 + 1];
|
||||
|
||||
static uint8_t uni_mpeg1_ac_vlc_len[64 * 64 * 2];
|
||||
@@ -144,9 +144,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
{
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
|
||||
if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && avctx->height > 2800)
|
||||
avctx->thread_count = 1;
|
||||
|
||||
if (ff_mpv_encode_init(avctx) < 0)
|
||||
return -1;
|
||||
|
||||
@@ -1051,7 +1048,7 @@ av_cold void ff_mpeg1_encode_init(MpegEncContext *s)
|
||||
}
|
||||
|
||||
for (f_code = 1; f_code <= MAX_FCODE; f_code++)
|
||||
for (mv = -MAX_MV; mv <= MAX_MV; mv++) {
|
||||
for (mv = -MAX_DMV; mv <= MAX_DMV; mv++) {
|
||||
int len;
|
||||
|
||||
if (mv == 0) {
|
||||
@@ -1074,7 +1071,7 @@ av_cold void ff_mpeg1_encode_init(MpegEncContext *s)
|
||||
2 + bit_size;
|
||||
}
|
||||
|
||||
mv_penalty[f_code][mv + MAX_MV] = len;
|
||||
mv_penalty[f_code][mv + MAX_DMV] = len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s,
|
||||
void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n,
|
||||
int dir);
|
||||
void ff_set_mpeg4_time(MpegEncContext *s);
|
||||
void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
|
||||
int ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
|
||||
|
||||
int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb);
|
||||
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s);
|
||||
|
||||
@@ -881,7 +881,7 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
|
||||
const int part_a_end = s->pict_type == AV_PICTURE_TYPE_I ? (ER_DC_END | ER_MV_END) : ER_MV_END;
|
||||
|
||||
mb_num = mpeg4_decode_partition_a(ctx);
|
||||
if (mb_num < 0) {
|
||||
if (mb_num <= 0) {
|
||||
ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
|
||||
s->mb_x, s->mb_y, part_a_error);
|
||||
return -1;
|
||||
@@ -1874,6 +1874,10 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
int last = 0;
|
||||
for (i = 0; i < 64; i++) {
|
||||
int j;
|
||||
if (get_bits_left(gb) < 8) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "insufficient data for custom matrix\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
v = get_bits(gb, 8);
|
||||
if (v == 0)
|
||||
break;
|
||||
@@ -1897,6 +1901,10 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
int last = 0;
|
||||
for (i = 0; i < 64; i++) {
|
||||
int j;
|
||||
if (get_bits_left(gb) < 8) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "insufficient data for custom matrix\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
v = get_bits(gb, 8);
|
||||
if (v == 0)
|
||||
break;
|
||||
|
||||
@@ -1086,7 +1086,7 @@ static void mpeg4_encode_vol_header(MpegEncContext *s,
|
||||
}
|
||||
|
||||
/* write mpeg4 VOP header */
|
||||
void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
int ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
{
|
||||
int time_incr;
|
||||
int time_div, time_mod;
|
||||
@@ -1112,6 +1112,12 @@ void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
time_mod = FFUMOD(s->time, s->avctx->time_base.den);
|
||||
time_incr = time_div - s->last_time_base;
|
||||
av_assert0(time_incr >= 0);
|
||||
|
||||
// This limits the frame duration to max 1 hour
|
||||
if (time_incr > 3600) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "time_incr %d too large\n", time_incr);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
while (time_incr--)
|
||||
put_bits(&s->pb, 1, 1);
|
||||
|
||||
@@ -1137,6 +1143,8 @@ void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
put_bits(&s->pb, 3, s->f_code); /* fcode_for */
|
||||
if (s->pict_type == AV_PICTURE_TYPE_B)
|
||||
put_bits(&s->pb, 3, s->b_code); /* fcode_back */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static av_cold void init_uni_dc_tab(void)
|
||||
|
||||
@@ -1318,6 +1318,7 @@ static void clear_context(MpegEncContext *s)
|
||||
|
||||
s->parse_context.buffer = NULL;
|
||||
s->parse_context.buffer_size = 0;
|
||||
s->parse_context.overread = 0;
|
||||
s->bitstream_buffer = NULL;
|
||||
s->allocated_bitstream_buffer_size = 0;
|
||||
s->picture = NULL;
|
||||
|
||||
@@ -66,6 +66,7 @@ enum OutputFormat {
|
||||
|
||||
#define MAX_FCODE 7
|
||||
#define MAX_MV 4096
|
||||
#define MAX_DMV (2*MAX_MV)
|
||||
|
||||
#define MAX_THREADS 32
|
||||
#define MAX_PICTURE_COUNT 36
|
||||
@@ -198,7 +199,7 @@ typedef struct MotionEstContext{
|
||||
op_pixels_func (*hpel_avg)[4];
|
||||
qpel_mc_func (*qpel_put)[16];
|
||||
qpel_mc_func (*qpel_avg)[16];
|
||||
uint8_t (*mv_penalty)[MAX_MV*2+1]; ///< amount of bits needed to encode a MV
|
||||
uint8_t (*mv_penalty)[MAX_DMV*2+1]; ///< amount of bits needed to encode a MV
|
||||
uint8_t *current_mv_penalty;
|
||||
int (*sub_motion_search)(struct MpegEncContext * s,
|
||||
int *mx_ptr, int *my_ptr, int dmin,
|
||||
|
||||
@@ -70,7 +70,7 @@ static int sse_mb(MpegEncContext *s);
|
||||
static void denoise_dct_c(MpegEncContext *s, int16_t *block);
|
||||
static int dct_quantize_trellis_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
|
||||
|
||||
static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_MV * 2 + 1];
|
||||
static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
|
||||
static uint8_t default_fcode_tab[MAX_MV * 2 + 1];
|
||||
|
||||
const AVOption ff_mpv_generic_options[] = {
|
||||
@@ -315,6 +315,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
||||
break;
|
||||
}
|
||||
|
||||
avctx->bits_per_raw_sample = av_clip(avctx->bits_per_raw_sample, 0, 8);
|
||||
s->bit_rate = avctx->bit_rate;
|
||||
s->width = avctx->width;
|
||||
s->height = avctx->height;
|
||||
@@ -2732,6 +2733,11 @@ int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, size_t threshold, size_t s
|
||||
uint8_t *new_buffer = NULL;
|
||||
int new_buffer_size = 0;
|
||||
|
||||
if ((s->avctx->internal->byte_buffer_size + size_increase) >= INT_MAX/8) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Cannot reallocate putbit buffer\n");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
av_fast_padded_malloc(&new_buffer, &new_buffer_size,
|
||||
s->avctx->internal->byte_buffer_size + size_increase);
|
||||
if (!new_buffer)
|
||||
@@ -3713,9 +3719,11 @@ static int encode_picture(MpegEncContext *s, int picture_number)
|
||||
ff_wmv2_encode_picture_header(s, picture_number);
|
||||
else if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version)
|
||||
ff_msmpeg4_encode_picture_header(s, picture_number);
|
||||
else if (CONFIG_MPEG4_ENCODER && s->h263_pred)
|
||||
ff_mpeg4_encode_picture_header(s, picture_number);
|
||||
else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10) {
|
||||
else if (CONFIG_MPEG4_ENCODER && s->h263_pred) {
|
||||
ret = ff_mpeg4_encode_picture_header(s, picture_number);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10) {
|
||||
ret = ff_rv10_encode_picture_header(s, picture_number);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+6
-1
@@ -209,8 +209,13 @@ static int decode_555(GetByteContext *gB, uint16_t *dst, int stride,
|
||||
last_symbol = b << 8 | bytestream2_get_byte(gB);
|
||||
else if (b > 129) {
|
||||
repeat = 0;
|
||||
while (b-- > 130)
|
||||
while (b-- > 130) {
|
||||
if (repeat >= (INT_MAX >> 8) - 1) {
|
||||
av_log(NULL, AV_LOG_ERROR, "repeat overflow\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
repeat = (repeat << 8) + bytestream2_get_byte(gB) + 1;
|
||||
}
|
||||
if (last_symbol == -2) {
|
||||
int skip = FFMIN((unsigned)repeat, dst + w - p);
|
||||
repeat -= skip;
|
||||
|
||||
+9
-2
@@ -211,9 +211,16 @@ static inline int get_egolomb(GetBitContext *gb)
|
||||
{
|
||||
int v = 4;
|
||||
|
||||
while (get_bits1(gb)) v++;
|
||||
while (get_bits1(gb)) {
|
||||
v++;
|
||||
if (v > 30) {
|
||||
av_log(NULL, AV_LOG_WARNING, "Too large golomb code in get_egolomb.\n");
|
||||
v = 30;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (1 << v) + get_bits(gb, v);
|
||||
return (1 << v) + get_bits_long(gb, v);
|
||||
}
|
||||
|
||||
static int on2avc_decode_pairs(On2AVCContext *c, GetBitContext *gb, float *dst,
|
||||
|
||||
@@ -824,7 +824,7 @@ static inline void silk_stabilize_lsf(int16_t nlsf[16], int order, const uint16_
|
||||
|
||||
/* upper extent */
|
||||
for (i = order; i > k; i--)
|
||||
max_center -= min_delta[k];
|
||||
max_center -= min_delta[i];
|
||||
max_center -= min_delta[k] >> 1;
|
||||
|
||||
/* move apart */
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/opt.h"
|
||||
|
||||
#define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
|
||||
#define RGBA(r,g,b,a) (((unsigned)(a) << 24) | ((r) << 16) | ((g) << 8) | (b))
|
||||
#define MAX_EPOCH_PALETTES 8 // Max 8 allowed per PGS epoch
|
||||
#define MAX_EPOCH_OBJECTS 64 // Max 64 allowed per PGS epoch
|
||||
#define MAX_OBJECT_REFS 2 // Max objects per display set
|
||||
@@ -354,8 +354,14 @@ static int parse_palette_segment(AVCodecContext *avctx,
|
||||
cb = bytestream_get_byte(&buf);
|
||||
alpha = bytestream_get_byte(&buf);
|
||||
|
||||
YUV_TO_RGB1(cb, cr);
|
||||
YUV_TO_RGB2(r, g, b, y);
|
||||
/* Default to BT.709 colorimetry. In case of <= 576 height use BT.601 */
|
||||
if (avctx->height <= 0 || avctx->height > 576) {
|
||||
YUV_TO_RGB1_CCIR_BT709(cb, cr);
|
||||
} else {
|
||||
YUV_TO_RGB1_CCIR(cb, cr);
|
||||
}
|
||||
|
||||
YUV_TO_RGB2_CCIR(r, g, b, y);
|
||||
|
||||
av_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);
|
||||
|
||||
|
||||
@@ -193,6 +193,12 @@ int ff_slice_thread_init(AVCodecContext *avctx)
|
||||
w32thread_init();
|
||||
#endif
|
||||
|
||||
// We cannot do this in the encoder init as the threads are created before
|
||||
if (av_codec_is_encoder(avctx->codec) &&
|
||||
avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO &&
|
||||
avctx->height > 2800)
|
||||
thread_count = avctx->thread_count = 1;
|
||||
|
||||
if (!thread_count) {
|
||||
int nb_cpus = av_cpu_count();
|
||||
if (avctx->height)
|
||||
|
||||
+15
-7
@@ -105,7 +105,7 @@ static inline void flush_put_bits(PutBitContext *s)
|
||||
s->bit_buf <<= s->bit_left;
|
||||
#endif
|
||||
while (s->bit_left < 32) {
|
||||
/* XXX: should test end of buffer */
|
||||
av_assert0(s->buf_ptr < s->buf_end);
|
||||
#ifdef BITSTREAM_WRITER_LE
|
||||
*s->buf_ptr++ = s->bit_buf;
|
||||
s->bit_buf >>= 8;
|
||||
@@ -163,9 +163,13 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
|
||||
#ifdef BITSTREAM_WRITER_LE
|
||||
bit_buf |= value << (32 - bit_left);
|
||||
if (n >= bit_left) {
|
||||
av_assert2(s->buf_ptr+3<s->buf_end);
|
||||
AV_WL32(s->buf_ptr, bit_buf);
|
||||
s->buf_ptr += 4;
|
||||
if (3 < s->buf_end - s->buf_ptr) {
|
||||
AV_WL32(s->buf_ptr, bit_buf);
|
||||
s->buf_ptr += 4;
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_ERROR, "Internal error, put_bits buffer too small\n");
|
||||
av_assert2(0);
|
||||
}
|
||||
bit_buf = (bit_left == 32) ? 0 : value >> bit_left;
|
||||
bit_left += 32;
|
||||
}
|
||||
@@ -177,9 +181,13 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
|
||||
} else {
|
||||
bit_buf <<= bit_left;
|
||||
bit_buf |= value >> (n - bit_left);
|
||||
av_assert2(s->buf_ptr+3<s->buf_end);
|
||||
AV_WB32(s->buf_ptr, bit_buf);
|
||||
s->buf_ptr += 4;
|
||||
if (3 < s->buf_end - s->buf_ptr) {
|
||||
AV_WB32(s->buf_ptr, bit_buf);
|
||||
s->buf_ptr += 4;
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_ERROR, "Internal error, put_bits buffer too small\n");
|
||||
av_assert2(0);
|
||||
}
|
||||
bit_left += 32 - n;
|
||||
bit_buf = value;
|
||||
}
|
||||
|
||||
+1
-1
@@ -258,7 +258,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
buf += buf_size - context->frame_size;
|
||||
|
||||
len = context->frame_size - (avctx->pix_fmt==AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0);
|
||||
if (buf_size < len && (avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0)) {
|
||||
if (buf_size < len && ((avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0) || !need_copy)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid buffer size, packet size %d < expected frame_size %d\n", buf_size, len);
|
||||
av_buffer_unref(&frame->buf[0]);
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
@@ -290,12 +290,6 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
|
||||
short *output_bak = NULL;
|
||||
int lenout;
|
||||
|
||||
if (s->input_channels == s->output_channels && s->ratio == 1.0 && 0) {
|
||||
/* nothing to do */
|
||||
memcpy(output, input, nb_samples * s->input_channels * sizeof(short));
|
||||
return nb_samples;
|
||||
}
|
||||
|
||||
if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) {
|
||||
int istride[1] = { s->sample_size[0] };
|
||||
int ostride[1] = { 2 };
|
||||
|
||||
+4
-5
@@ -79,11 +79,6 @@ static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf,
|
||||
case 8:
|
||||
avctx->channel_layout = AV_CH_LAYOUT_5POINT1_BACK | AV_CH_LAYOUT_STEREO_DOWNMIX;
|
||||
}
|
||||
avctx->sample_rate = 48000;
|
||||
avctx->bit_rate = 48000 * avctx->channels * (avctx->bits_per_raw_sample + 4) +
|
||||
32 * (48000 / (buf_size * 8 /
|
||||
(avctx->channels *
|
||||
(avctx->bits_per_raw_sample + 4))));
|
||||
|
||||
return frame_size;
|
||||
}
|
||||
@@ -109,6 +104,8 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
avctx->bit_rate = 48000 * avctx->channels * (avctx->bits_per_raw_sample + 4) +
|
||||
32 * 48000 / frame->nb_samples;
|
||||
buf_size = (frame->nb_samples * avctx->channels / 2) * block_size;
|
||||
|
||||
if (avctx->bits_per_raw_sample == 24) {
|
||||
@@ -146,6 +143,8 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
}
|
||||
|
||||
avctx->sample_rate = 48000;
|
||||
|
||||
*got_frame_ptr = 1;
|
||||
|
||||
return avpkt->size;
|
||||
|
||||
@@ -286,7 +286,7 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){
|
||||
c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
|
||||
c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp);
|
||||
c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp);
|
||||
c->current_mv_penalty= c->mv_penalty[s->m.f_code=1] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->m.f_code=1] + MAX_DMV;
|
||||
|
||||
c->xmin = - x*block_w - 16+3;
|
||||
c->ymin = - y*block_w - 16+3;
|
||||
|
||||
@@ -925,6 +925,13 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
|
||||
s->frame_size = s->channels*s->block_align*s->downsampling;
|
||||
// avctx->frame_size = s->block_align;
|
||||
|
||||
if (s->num_taps * s->channels > s->frame_size) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"number of taps times channels (%d * %d) larger than frame size %d\n",
|
||||
s->num_taps, s->channels, s->frame_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
|
||||
s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);
|
||||
|
||||
|
||||
+2
-1
@@ -224,6 +224,7 @@ static void decode_lpc(int32_t *coeffs, int mode, int length)
|
||||
int a3 = coeffs[2];
|
||||
int a4 = a3 + a1;
|
||||
int a5 = a4 + a2;
|
||||
coeffs[2] = a5;
|
||||
coeffs += 3;
|
||||
for (i = 0; i < length - 3; i++) {
|
||||
a3 += *coeffs;
|
||||
@@ -656,7 +657,7 @@ static int decorrelate(TAKDecContext *s, int c1, int c2, int length)
|
||||
*p1++ = v;
|
||||
}
|
||||
|
||||
memcpy(s->residues, &s->residues[tmp], 2 * filter_order);
|
||||
memmove(s->residues, &s->residues[tmp], 2 * filter_order);
|
||||
}
|
||||
|
||||
emms_c();
|
||||
|
||||
+7
-2
@@ -1000,8 +1000,13 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
av_log(s->avctx, AV_LOG_ERROR, "subsample count invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
for (i = 0; i < count; i++)
|
||||
for (i = 0; i < count; i++) {
|
||||
s->subsampling[i] = ff_tget(&s->gb, type, s->le);
|
||||
if (s->subsampling[i] <= 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "subsampling %d is invalid\n", s->subsampling[i]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TIFF_T4OPTIONS:
|
||||
if (s->compr == TIFF_G3)
|
||||
@@ -1249,7 +1254,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
avpkt->size - s->strippos);
|
||||
}
|
||||
|
||||
if (s->rps <= 0) {
|
||||
if (s->rps <= 0 || s->rps % s->subsampling[1]) {
|
||||
av_log(avctx, AV_LOG_ERROR, "rps %d invalid\n", s->rps);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
+13
-2
@@ -114,9 +114,12 @@ static int tta_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
{
|
||||
TTAEncContext *s = avctx->priv_data;
|
||||
PutBitContext pb;
|
||||
int ret, i, out_bytes, cur_chan = 0, res = 0, samples = 0;
|
||||
int ret, i, out_bytes, cur_chan, res, samples;
|
||||
int64_t pkt_size = frame->nb_samples * 2LL * avctx->channels * s->bps;
|
||||
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, frame->nb_samples * 2 * avctx->channels * s->bps)) < 0)
|
||||
pkt_alloc:
|
||||
cur_chan = 0, res = 0, samples = 0;
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, pkt_size)) < 0)
|
||||
return ret;
|
||||
init_put_bits(&pb, avpkt->data, avpkt->size);
|
||||
|
||||
@@ -174,6 +177,14 @@ static int tta_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
rice->k1++;
|
||||
|
||||
unary = 1 + (outval >> k);
|
||||
if (unary + 100LL > put_bits_left(&pb)) {
|
||||
if (pkt_size < INT_MAX/2) {
|
||||
pkt_size *= 2;
|
||||
av_packet_unref(avpkt);
|
||||
goto pkt_alloc;
|
||||
} else
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
do {
|
||||
if (unary > 31) {
|
||||
put_bits(&pb, 31, 0x7FFFFFFF);
|
||||
|
||||
+5
-3
@@ -1032,8 +1032,10 @@ end:
|
||||
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
|
||||
{
|
||||
int ret = get_buffer_internal(avctx, frame, flags);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
frame->width = frame->height = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3092,8 +3094,8 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
|
||||
|
||||
if (enc->sample_aspect_ratio.num) {
|
||||
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
|
||||
enc->width * enc->sample_aspect_ratio.num,
|
||||
enc->height * enc->sample_aspect_ratio.den,
|
||||
enc->width * (int64_t)enc->sample_aspect_ratio.num,
|
||||
enc->height * (int64_t)enc->sample_aspect_ratio.den,
|
||||
1024 * 1024);
|
||||
snprintf(buf + strlen(buf), buf_size - strlen(buf),
|
||||
" [SAR %d:%d DAR %d:%d]",
|
||||
|
||||
@@ -573,6 +573,11 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
rangebits = get_bits(gb, 4);
|
||||
if (!rangebits && floor_setup->data.t1.partitions) {
|
||||
av_log(vc->avctx, AV_LOG_ERROR,
|
||||
"A rangebits value of 0 is not compliant with the Vorbis I specification.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
rangemax = (1 << rangebits);
|
||||
if (rangemax > vc->blocksize[1] / 2) {
|
||||
av_log(vc->avctx, AV_LOG_ERROR,
|
||||
@@ -789,6 +794,11 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
|
||||
|
||||
if (get_bits1(gb)) {
|
||||
mapping_setup->coupling_steps = get_bits(gb, 8) + 1;
|
||||
if (vc->audio_channels < 2) {
|
||||
av_log(vc->avctx, AV_LOG_ERROR,
|
||||
"Square polar channel mapping with less than two channels is not compliant with the Vorbis I specification.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
mapping_setup->magnitude = av_mallocz(mapping_setup->coupling_steps *
|
||||
sizeof(*mapping_setup->magnitude));
|
||||
mapping_setup->angle = av_mallocz(mapping_setup->coupling_steps *
|
||||
|
||||
+16
-8
@@ -131,7 +131,7 @@ static const uint8_t hilbert_offset[16][2] = {
|
||||
|
||||
typedef struct Vp3DecodeContext {
|
||||
AVCodecContext *avctx;
|
||||
int theora, theora_tables;
|
||||
int theora, theora_tables, theora_header;
|
||||
int version;
|
||||
int width, height;
|
||||
int chroma_x_shift, chroma_y_shift;
|
||||
@@ -209,8 +209,8 @@ typedef struct Vp3DecodeContext {
|
||||
int16_t *dct_tokens[3][64];
|
||||
int16_t *dct_tokens_base;
|
||||
#define TOKEN_EOB(eob_run) ((eob_run) << 2)
|
||||
#define TOKEN_ZERO_RUN(coeff, zero_run) (((coeff) << 9) + ((zero_run) << 2) + 1)
|
||||
#define TOKEN_COEFF(coeff) (((coeff) << 2) + 2)
|
||||
#define TOKEN_ZERO_RUN(coeff, zero_run) (((coeff) * 512) + ((zero_run) << 2) + 1)
|
||||
#define TOKEN_COEFF(coeff) (((coeff) * 4) + 2)
|
||||
|
||||
/**
|
||||
* number of blocks that contain DCT coefficients at
|
||||
@@ -2014,17 +2014,19 @@ static int vp3_decode_frame(AVCodecContext *avctx,
|
||||
vp3_decode_end(avctx);
|
||||
ret = theora_decode_header(avctx, &gb);
|
||||
|
||||
if (ret >= 0)
|
||||
ret = vp3_decode_init(avctx);
|
||||
if (ret < 0) {
|
||||
vp3_decode_end(avctx);
|
||||
} else
|
||||
ret = vp3_decode_init(avctx);
|
||||
}
|
||||
return ret;
|
||||
} else if (type == 2) {
|
||||
ret = theora_decode_tables(avctx, &gb);
|
||||
if (ret >= 0)
|
||||
ret = vp3_decode_init(avctx);
|
||||
if (ret < 0) {
|
||||
vp3_decode_end(avctx);
|
||||
} else
|
||||
ret = vp3_decode_init(avctx);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2249,6 +2251,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
|
||||
int ret;
|
||||
AVRational fps, aspect;
|
||||
|
||||
s->theora_header = 0;
|
||||
s->theora = get_bits_long(gb, 24);
|
||||
av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
|
||||
|
||||
@@ -2319,7 +2322,8 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
skip_bits(gb, 3); /* reserved */
|
||||
}
|
||||
} else
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
|
||||
ret = ff_set_dimensions(avctx, s->width, s->height);
|
||||
if (ret < 0)
|
||||
@@ -2353,6 +2357,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
|
||||
avctx->color_trc = AVCOL_TRC_BT709;
|
||||
}
|
||||
|
||||
s->theora_header = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2361,6 +2366,9 @@ static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb)
|
||||
Vp3DecodeContext *s = avctx->priv_data;
|
||||
int i, n, matrices, inter, plane;
|
||||
|
||||
if (!s->theora_header)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (s->theora >= 0x030200) {
|
||||
n = get_bits(gb, 3);
|
||||
/* loop filter limit values table */
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ int update_dimensions(VP8Context *s, int width, int height, int is_vp7)
|
||||
s->mb_height = (s->avctx->coded_height + 15) / 16;
|
||||
|
||||
s->mb_layout = is_vp7 || avctx->active_thread_type == FF_THREAD_SLICE &&
|
||||
FFMIN(s->num_coeff_partitions, avctx->thread_count) > 1;
|
||||
avctx->thread_count > 1;
|
||||
if (!s->mb_layout) { // Frame threading and one thread
|
||||
s->macroblocks_base = av_mallocz((s->mb_width + s->mb_height * 2 + 1) *
|
||||
sizeof(*s->macroblocks));
|
||||
|
||||
+160
-156
@@ -240,7 +240,7 @@ typedef struct VP9Context {
|
||||
// whole-frame cache
|
||||
uint8_t *intra_pred_data[3];
|
||||
struct VP9Filter *lflvl;
|
||||
DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[71*80];
|
||||
DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[135*144];
|
||||
|
||||
// block reconstruction intermediates
|
||||
int block_alloc_using_2pass;
|
||||
@@ -249,6 +249,8 @@ typedef struct VP9Context {
|
||||
struct { int x, y; } min_mv, max_mv;
|
||||
DECLARE_ALIGNED(32, uint8_t, tmp_y)[64*64];
|
||||
DECLARE_ALIGNED(32, uint8_t, tmp_uv)[2][32*32];
|
||||
uint16_t mvscale[3][2];
|
||||
uint8_t mvstep[3][2];
|
||||
} VP9Context;
|
||||
|
||||
static const uint8_t bwh_tab[2][N_BS_SIZES][2] = {
|
||||
@@ -583,6 +585,26 @@ static int decode_frame_header(AVCodecContext *ctx,
|
||||
s->varcompref[1] = 2;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
AVFrame *ref = s->refs[s->refidx[i]].f;
|
||||
int refw = ref->width, refh = ref->height;
|
||||
|
||||
if (refw == w && refh == h) {
|
||||
s->mvscale[i][0] = s->mvscale[i][1] = 0;
|
||||
} else {
|
||||
if (w * 2 < refw || h * 2 < refh || w > 16 * refw || h > 16 * refh) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"Invalid ref frame dimensions %dx%d for frame size %dx%d\n",
|
||||
refw, refh, w, h);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->mvscale[i][0] = (refw << 14) / w;
|
||||
s->mvscale[i][1] = (refh << 14) / h;
|
||||
s->mvstep[i][0] = 16 * s->mvscale[i][0] >> 14;
|
||||
s->mvstep[i][1] = 16 * s->mvscale[i][1] >> 14;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
s->refreshctx = s->errorres ? 0 : get_bits1(&s->gb);
|
||||
@@ -2537,12 +2559,118 @@ static void intra_recon(AVCodecContext *ctx, ptrdiff_t y_off, ptrdiff_t uv_off)
|
||||
}
|
||||
}
|
||||
|
||||
static av_always_inline void mc_luma_dir(VP9Context *s, vp9_mc_func (*mc)[2],
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *ref, ptrdiff_t ref_stride,
|
||||
ThreadFrame *ref_frame,
|
||||
ptrdiff_t y, ptrdiff_t x, const VP56mv *mv,
|
||||
int bw, int bh, int w, int h)
|
||||
static av_always_inline void mc_luma_scaled(VP9Context *s, vp9_scaled_mc_func smc,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *ref, ptrdiff_t ref_stride,
|
||||
ThreadFrame *ref_frame,
|
||||
ptrdiff_t y, ptrdiff_t x, const VP56mv *mv,
|
||||
int bw, int bh, int w, int h,
|
||||
const uint16_t *scale, const uint8_t *step)
|
||||
{
|
||||
#define scale_mv(n, dim) (((int64_t)n * scale[dim]) >> 14)
|
||||
// BUG libvpx seems to scale the two components separately. This introduces
|
||||
// rounding errors but we have to reproduce them to be exactly compatible
|
||||
// with the output from libvpx...
|
||||
int mx = scale_mv(mv->x * 2, 0) + scale_mv(x * 16, 0);
|
||||
int my = scale_mv(mv->y * 2, 1) + scale_mv(y * 16, 1);
|
||||
int refbw_m1, refbh_m1;
|
||||
int th;
|
||||
|
||||
y = my >> 4;
|
||||
x = mx >> 4;
|
||||
ref += y * ref_stride + x;
|
||||
mx &= 15;
|
||||
my &= 15;
|
||||
refbw_m1 = ((bw - 1) * step[0] + mx) >> 4;
|
||||
refbh_m1 = ((bh - 1) * step[1] + my) >> 4;
|
||||
// FIXME bilinear filter only needs 0/1 pixels, not 3/4
|
||||
// we use +7 because the last 7 pixels of each sbrow can be changed in
|
||||
// the longest loopfilter of the next sbrow
|
||||
th = (y + refbh_m1 + 4 + 7) >> 6;
|
||||
ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
|
||||
if (x < 3 || y < 3 || x + 4 >= w - refbw_m1 || y + 4 >= h - refbh_m1) {
|
||||
s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
|
||||
ref - 3 * ref_stride - 3,
|
||||
144, ref_stride,
|
||||
refbw_m1 + 8, refbh_m1 + 8,
|
||||
x - 3, y - 3, w, h);
|
||||
ref = s->edge_emu_buffer + 3 * 144 + 3;
|
||||
ref_stride = 144;
|
||||
}
|
||||
smc(dst, dst_stride, ref, ref_stride, bh, mx, my, step[0], step[1]);
|
||||
}
|
||||
|
||||
static av_always_inline void mc_chroma_scaled(VP9Context *s, vp9_scaled_mc_func smc,
|
||||
uint8_t *dst_u, uint8_t *dst_v,
|
||||
ptrdiff_t dst_stride,
|
||||
const uint8_t *ref_u, ptrdiff_t src_stride_u,
|
||||
const uint8_t *ref_v, ptrdiff_t src_stride_v,
|
||||
ThreadFrame *ref_frame,
|
||||
ptrdiff_t y, ptrdiff_t x, const VP56mv *mv,
|
||||
int bw, int bh, int w, int h,
|
||||
const uint16_t *scale, const uint8_t *step)
|
||||
{
|
||||
// BUG https://code.google.com/p/webm/issues/detail?id=820
|
||||
int mx = scale_mv(mv->x, 0) + (scale_mv(x * 16, 0) & ~15) + (scale_mv(x * 32, 0) & 15);
|
||||
int my = scale_mv(mv->y, 1) + (scale_mv(y * 16, 1) & ~15) + (scale_mv(y * 32, 1) & 15);
|
||||
#undef scale_mv
|
||||
int refbw_m1, refbh_m1;
|
||||
int th;
|
||||
|
||||
y = my >> 4;
|
||||
x = mx >> 4;
|
||||
ref_u += y * src_stride_u + x;
|
||||
ref_v += y * src_stride_v + x;
|
||||
mx &= 15;
|
||||
my &= 15;
|
||||
refbw_m1 = ((bw - 1) * step[0] + mx) >> 4;
|
||||
refbh_m1 = ((bh - 1) * step[1] + my) >> 4;
|
||||
// FIXME bilinear filter only needs 0/1 pixels, not 3/4
|
||||
// we use +7 because the last 7 pixels of each sbrow can be changed in
|
||||
// the longest loopfilter of the next sbrow
|
||||
th = (y + refbh_m1 + 4 + 7) >> 5;
|
||||
ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
|
||||
if (x < 3 || y < 3 || x + 4 >= w - refbw_m1 || y + 4 >= h - refbh_m1) {
|
||||
s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
|
||||
ref_u - 3 * src_stride_u - 3,
|
||||
144, src_stride_u,
|
||||
refbw_m1 + 8, refbh_m1 + 8,
|
||||
x - 3, y - 3, w, h);
|
||||
ref_u = s->edge_emu_buffer + 3 * 144 + 3;
|
||||
smc(dst_u, dst_stride, ref_u, 144, bh, mx, my, step[0], step[1]);
|
||||
|
||||
s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
|
||||
ref_v - 3 * src_stride_v - 3,
|
||||
144, src_stride_v,
|
||||
refbw_m1 + 8, refbh_m1 + 8,
|
||||
x - 3, y - 3, w, h);
|
||||
ref_v = s->edge_emu_buffer + 3 * 144 + 3;
|
||||
smc(dst_v, dst_stride, ref_v, 144, bh, mx, my, step[0], step[1]);
|
||||
} else {
|
||||
smc(dst_u, dst_stride, ref_u, src_stride_u, bh, mx, my, step[0], step[1]);
|
||||
smc(dst_v, dst_stride, ref_v, src_stride_v, bh, mx, my, step[0], step[1]);
|
||||
}
|
||||
}
|
||||
|
||||
#define FN(x) x##_scaled
|
||||
#define mc_luma_dir(s, mc, dst, dst_ls, src, src_ls, tref, row, col, mv, bw, bh, w, h, i) \
|
||||
mc_luma_scaled(s, s->dsp.s##mc, dst, dst_ls, src, src_ls, tref, row, col, \
|
||||
mv, bw, bh, w, h, s->mvscale[b->ref[i]], s->mvstep[b->ref[i]])
|
||||
#define mc_chroma_dir(s, mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
|
||||
row, col, mv, bw, bh, w, h, i) \
|
||||
mc_chroma_scaled(s, s->dsp.s##mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
|
||||
row, col, mv, bw, bh, w, h, s->mvscale[b->ref[i]], s->mvstep[b->ref[i]])
|
||||
#include "vp9_mc_template.c"
|
||||
#undef mc_luma_dir
|
||||
#undef mc_chroma_dir
|
||||
#undef FN
|
||||
|
||||
static av_always_inline void mc_luma_unscaled(VP9Context *s, vp9_mc_func (*mc)[2],
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *ref, ptrdiff_t ref_stride,
|
||||
ThreadFrame *ref_frame,
|
||||
ptrdiff_t y, ptrdiff_t x, const VP56mv *mv,
|
||||
int bw, int bh, int w, int h)
|
||||
{
|
||||
int mx = mv->x, my = mv->y, th;
|
||||
|
||||
@@ -2569,14 +2697,14 @@ static av_always_inline void mc_luma_dir(VP9Context *s, vp9_mc_func (*mc)[2],
|
||||
mc[!!mx][!!my](dst, dst_stride, ref, ref_stride, bh, mx << 1, my << 1);
|
||||
}
|
||||
|
||||
static av_always_inline void mc_chroma_dir(VP9Context *s, vp9_mc_func (*mc)[2],
|
||||
uint8_t *dst_u, uint8_t *dst_v,
|
||||
ptrdiff_t dst_stride,
|
||||
const uint8_t *ref_u, ptrdiff_t src_stride_u,
|
||||
const uint8_t *ref_v, ptrdiff_t src_stride_v,
|
||||
ThreadFrame *ref_frame,
|
||||
ptrdiff_t y, ptrdiff_t x, const VP56mv *mv,
|
||||
int bw, int bh, int w, int h)
|
||||
static av_always_inline void mc_chroma_unscaled(VP9Context *s, vp9_mc_func (*mc)[2],
|
||||
uint8_t *dst_u, uint8_t *dst_v,
|
||||
ptrdiff_t dst_stride,
|
||||
const uint8_t *ref_u, ptrdiff_t src_stride_u,
|
||||
const uint8_t *ref_v, ptrdiff_t src_stride_v,
|
||||
ThreadFrame *ref_frame,
|
||||
ptrdiff_t y, ptrdiff_t x, const VP56mv *mv,
|
||||
int bw, int bh, int w, int h)
|
||||
{
|
||||
int mx = mv->x, my = mv->y, th;
|
||||
|
||||
@@ -2614,156 +2742,32 @@ static av_always_inline void mc_chroma_dir(VP9Context *s, vp9_mc_func (*mc)[2],
|
||||
}
|
||||
}
|
||||
|
||||
#define FN(x) x
|
||||
#define mc_luma_dir(s, mc, dst, dst_ls, src, src_ls, tref, row, col, mv, bw, bh, w, h, i) \
|
||||
mc_luma_unscaled(s, s->dsp.mc, dst, dst_ls, src, src_ls, tref, row, col, \
|
||||
mv, bw, bh, w, h)
|
||||
#define mc_chroma_dir(s, mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
|
||||
row, col, mv, bw, bh, w, h, i) \
|
||||
mc_chroma_unscaled(s, s->dsp.mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
|
||||
row, col, mv, bw, bh, w, h)
|
||||
#include "vp9_mc_template.c"
|
||||
#undef mc_luma_dir_dir
|
||||
#undef mc_chroma_dir_dir
|
||||
#undef FN
|
||||
|
||||
static void inter_recon(AVCodecContext *ctx)
|
||||
{
|
||||
static const uint8_t bwlog_tab[2][N_BS_SIZES] = {
|
||||
{ 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
|
||||
{ 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 },
|
||||
};
|
||||
VP9Context *s = ctx->priv_data;
|
||||
VP9Block *b = s->b;
|
||||
int row = s->row, col = s->col;
|
||||
ThreadFrame *tref1 = &s->refs[s->refidx[b->ref[0]]], *tref2;
|
||||
AVFrame *ref1 = tref1->f, *ref2;
|
||||
int w1 = ref1->width, h1 = ref1->height, w2, h2;
|
||||
ptrdiff_t ls_y = s->y_stride, ls_uv = s->uv_stride;
|
||||
|
||||
if (b->comp) {
|
||||
tref2 = &s->refs[s->refidx[b->ref[1]]];
|
||||
ref2 = tref2->f;
|
||||
w2 = ref2->width;
|
||||
h2 = ref2->height;
|
||||
}
|
||||
|
||||
// y inter pred
|
||||
if (b->bs > BS_8x8) {
|
||||
if (b->bs == BS_8x4) {
|
||||
mc_luma_dir(s, s->dsp.mc[3][b->filter][0], s->dst[0], ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
row << 3, col << 3, &b->mv[0][0], 8, 4, w1, h1);
|
||||
mc_luma_dir(s, s->dsp.mc[3][b->filter][0],
|
||||
s->dst[0] + 4 * ls_y, ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
(row << 3) + 4, col << 3, &b->mv[2][0], 8, 4, w1, h1);
|
||||
|
||||
if (b->comp) {
|
||||
mc_luma_dir(s, s->dsp.mc[3][b->filter][1], s->dst[0], ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
row << 3, col << 3, &b->mv[0][1], 8, 4, w2, h2);
|
||||
mc_luma_dir(s, s->dsp.mc[3][b->filter][1],
|
||||
s->dst[0] + 4 * ls_y, ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
(row << 3) + 4, col << 3, &b->mv[2][1], 8, 4, w2, h2);
|
||||
}
|
||||
} else if (b->bs == BS_4x8) {
|
||||
mc_luma_dir(s, s->dsp.mc[4][b->filter][0], s->dst[0], ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
row << 3, col << 3, &b->mv[0][0], 4, 8, w1, h1);
|
||||
mc_luma_dir(s, s->dsp.mc[4][b->filter][0], s->dst[0] + 4, ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
row << 3, (col << 3) + 4, &b->mv[1][0], 4, 8, w1, h1);
|
||||
|
||||
if (b->comp) {
|
||||
mc_luma_dir(s, s->dsp.mc[4][b->filter][1], s->dst[0], ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
row << 3, col << 3, &b->mv[0][1], 4, 8, w2, h2);
|
||||
mc_luma_dir(s, s->dsp.mc[4][b->filter][1], s->dst[0] + 4, ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
row << 3, (col << 3) + 4, &b->mv[1][1], 4, 8, w2, h2);
|
||||
}
|
||||
} else {
|
||||
av_assert2(b->bs == BS_4x4);
|
||||
|
||||
// FIXME if two horizontally adjacent blocks have the same MV,
|
||||
// do a w8 instead of a w4 call
|
||||
mc_luma_dir(s, s->dsp.mc[4][b->filter][0], s->dst[0], ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
row << 3, col << 3, &b->mv[0][0], 4, 4, w1, h1);
|
||||
mc_luma_dir(s, s->dsp.mc[4][b->filter][0], s->dst[0] + 4, ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
row << 3, (col << 3) + 4, &b->mv[1][0], 4, 4, w1, h1);
|
||||
mc_luma_dir(s, s->dsp.mc[4][b->filter][0],
|
||||
s->dst[0] + 4 * ls_y, ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
(row << 3) + 4, col << 3, &b->mv[2][0], 4, 4, w1, h1);
|
||||
mc_luma_dir(s, s->dsp.mc[4][b->filter][0],
|
||||
s->dst[0] + 4 * ls_y + 4, ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
(row << 3) + 4, (col << 3) + 4, &b->mv[3][0], 4, 4, w1, h1);
|
||||
|
||||
if (b->comp) {
|
||||
mc_luma_dir(s, s->dsp.mc[4][b->filter][1], s->dst[0], ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
row << 3, col << 3, &b->mv[0][1], 4, 4, w2, h2);
|
||||
mc_luma_dir(s, s->dsp.mc[4][b->filter][1], s->dst[0] + 4, ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
row << 3, (col << 3) + 4, &b->mv[1][1], 4, 4, w2, h2);
|
||||
mc_luma_dir(s, s->dsp.mc[4][b->filter][1],
|
||||
s->dst[0] + 4 * ls_y, ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
(row << 3) + 4, col << 3, &b->mv[2][1], 4, 4, w2, h2);
|
||||
mc_luma_dir(s, s->dsp.mc[4][b->filter][1],
|
||||
s->dst[0] + 4 * ls_y + 4, ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
(row << 3) + 4, (col << 3) + 4, &b->mv[3][1], 4, 4, w2, h2);
|
||||
}
|
||||
}
|
||||
if (s->mvscale[b->ref[0]][0] || (b->comp && s->mvscale[b->ref[1]][0])) {
|
||||
inter_pred_scaled(ctx);
|
||||
} else {
|
||||
int bwl = bwlog_tab[0][b->bs];
|
||||
int bw = bwh_tab[0][b->bs][0] * 4, bh = bwh_tab[0][b->bs][1] * 4;
|
||||
|
||||
mc_luma_dir(s, s->dsp.mc[bwl][b->filter][0], s->dst[0], ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
row << 3, col << 3, &b->mv[0][0],bw, bh, w1, h1);
|
||||
|
||||
if (b->comp)
|
||||
mc_luma_dir(s, s->dsp.mc[bwl][b->filter][1], s->dst[0], ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
row << 3, col << 3, &b->mv[0][1], bw, bh, w2, h2);
|
||||
inter_pred(ctx);
|
||||
}
|
||||
|
||||
// uv inter pred
|
||||
{
|
||||
int bwl = bwlog_tab[1][b->bs];
|
||||
int bw = bwh_tab[1][b->bs][0] * 4, bh = bwh_tab[1][b->bs][1] * 4;
|
||||
VP56mv mvuv;
|
||||
|
||||
w1 = (w1 + 1) >> 1;
|
||||
h1 = (h1 + 1) >> 1;
|
||||
if (b->comp) {
|
||||
w2 = (w2 + 1) >> 1;
|
||||
h2 = (h2 + 1) >> 1;
|
||||
}
|
||||
if (b->bs > BS_8x8) {
|
||||
mvuv.x = ROUNDED_DIV(b->mv[0][0].x + b->mv[1][0].x + b->mv[2][0].x + b->mv[3][0].x, 4);
|
||||
mvuv.y = ROUNDED_DIV(b->mv[0][0].y + b->mv[1][0].y + b->mv[2][0].y + b->mv[3][0].y, 4);
|
||||
} else {
|
||||
mvuv = b->mv[0][0];
|
||||
}
|
||||
|
||||
mc_chroma_dir(s, s->dsp.mc[bwl][b->filter][0],
|
||||
s->dst[1], s->dst[2], ls_uv,
|
||||
ref1->data[1], ref1->linesize[1],
|
||||
ref1->data[2], ref1->linesize[2], tref1,
|
||||
row << 2, col << 2, &mvuv, bw, bh, w1, h1);
|
||||
|
||||
if (b->comp) {
|
||||
if (b->bs > BS_8x8) {
|
||||
mvuv.x = ROUNDED_DIV(b->mv[0][1].x + b->mv[1][1].x + b->mv[2][1].x + b->mv[3][1].x, 4);
|
||||
mvuv.y = ROUNDED_DIV(b->mv[0][1].y + b->mv[1][1].y + b->mv[2][1].y + b->mv[3][1].y, 4);
|
||||
} else {
|
||||
mvuv = b->mv[0][1];
|
||||
}
|
||||
mc_chroma_dir(s, s->dsp.mc[bwl][b->filter][1],
|
||||
s->dst[1], s->dst[2], ls_uv,
|
||||
ref2->data[1], ref2->linesize[1],
|
||||
ref2->data[2], ref2->linesize[2], tref2,
|
||||
row << 2, col << 2, &mvuv, bw, bh, w2, h2);
|
||||
}
|
||||
}
|
||||
|
||||
if (!b->skip) {
|
||||
/* mostly copied intra_reconn() */
|
||||
/* mostly copied intra_recon() */
|
||||
|
||||
int w4 = bwh_tab[1][b->bs][0] << 1, step1d = 1 << b->tx, n;
|
||||
int h4 = bwh_tab[1][b->bs][1] << 1, x, y, step = 1 << (b->tx * 2);
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* VP9 compatible video decoder
|
||||
*
|
||||
* Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
|
||||
* Copyright (C) 2013 Clément Bœsch <u pkh me>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
static void FN(inter_pred)(AVCodecContext *ctx)
|
||||
{
|
||||
static const uint8_t bwlog_tab[2][N_BS_SIZES] = {
|
||||
{ 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
|
||||
{ 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 },
|
||||
};
|
||||
VP9Context *s = ctx->priv_data;
|
||||
VP9Block *b = s->b;
|
||||
int row = s->row, col = s->col;
|
||||
ThreadFrame *tref1 = &s->refs[s->refidx[b->ref[0]]], *tref2;
|
||||
AVFrame *ref1 = tref1->f, *ref2;
|
||||
int w1 = ref1->width, h1 = ref1->height, w2, h2;
|
||||
ptrdiff_t ls_y = s->y_stride, ls_uv = s->uv_stride;
|
||||
|
||||
if (b->comp) {
|
||||
tref2 = &s->refs[s->refidx[b->ref[1]]];
|
||||
ref2 = tref2->f;
|
||||
w2 = ref2->width;
|
||||
h2 = ref2->height;
|
||||
}
|
||||
|
||||
// y inter pred
|
||||
if (b->bs > BS_8x8) {
|
||||
if (b->bs == BS_8x4) {
|
||||
mc_luma_dir(s, mc[3][b->filter][0], s->dst[0], ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
row << 3, col << 3, &b->mv[0][0], 8, 4, w1, h1, 0);
|
||||
mc_luma_dir(s, mc[3][b->filter][0],
|
||||
s->dst[0] + 4 * ls_y, ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
(row << 3) + 4, col << 3, &b->mv[2][0], 8, 4, w1, h1, 0);
|
||||
|
||||
if (b->comp) {
|
||||
mc_luma_dir(s, mc[3][b->filter][1], s->dst[0], ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
row << 3, col << 3, &b->mv[0][1], 8, 4, w2, h2, 1);
|
||||
mc_luma_dir(s, mc[3][b->filter][1],
|
||||
s->dst[0] + 4 * ls_y, ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
(row << 3) + 4, col << 3, &b->mv[2][1], 8, 4, w2, h2, 1);
|
||||
}
|
||||
} else if (b->bs == BS_4x8) {
|
||||
mc_luma_dir(s, mc[4][b->filter][0], s->dst[0], ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
row << 3, col << 3, &b->mv[0][0], 4, 8, w1, h1, 0);
|
||||
mc_luma_dir(s, mc[4][b->filter][0], s->dst[0] + 4, ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
row << 3, (col << 3) + 4, &b->mv[1][0], 4, 8, w1, h1, 0);
|
||||
|
||||
if (b->comp) {
|
||||
mc_luma_dir(s, mc[4][b->filter][1], s->dst[0], ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
row << 3, col << 3, &b->mv[0][1], 4, 8, w2, h2, 1);
|
||||
mc_luma_dir(s, mc[4][b->filter][1], s->dst[0] + 4, ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
row << 3, (col << 3) + 4, &b->mv[1][1], 4, 8, w2, h2, 1);
|
||||
}
|
||||
} else {
|
||||
av_assert2(b->bs == BS_4x4);
|
||||
|
||||
// FIXME if two horizontally adjacent blocks have the same MV,
|
||||
// do a w8 instead of a w4 call
|
||||
mc_luma_dir(s, mc[4][b->filter][0], s->dst[0], ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
row << 3, col << 3, &b->mv[0][0], 4, 4, w1, h1, 0);
|
||||
mc_luma_dir(s, mc[4][b->filter][0], s->dst[0] + 4, ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
row << 3, (col << 3) + 4, &b->mv[1][0], 4, 4, w1, h1, 0);
|
||||
mc_luma_dir(s, mc[4][b->filter][0],
|
||||
s->dst[0] + 4 * ls_y, ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
(row << 3) + 4, col << 3, &b->mv[2][0], 4, 4, w1, h1, 0);
|
||||
mc_luma_dir(s, mc[4][b->filter][0],
|
||||
s->dst[0] + 4 * ls_y + 4, ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
(row << 3) + 4, (col << 3) + 4, &b->mv[3][0], 4, 4, w1, h1, 0);
|
||||
|
||||
if (b->comp) {
|
||||
mc_luma_dir(s, mc[4][b->filter][1], s->dst[0], ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
row << 3, col << 3, &b->mv[0][1], 4, 4, w2, h2, 1);
|
||||
mc_luma_dir(s, mc[4][b->filter][1], s->dst[0] + 4, ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
row << 3, (col << 3) + 4, &b->mv[1][1], 4, 4, w2, h2, 1);
|
||||
mc_luma_dir(s, mc[4][b->filter][1],
|
||||
s->dst[0] + 4 * ls_y, ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
(row << 3) + 4, col << 3, &b->mv[2][1], 4, 4, w2, h2, 1);
|
||||
mc_luma_dir(s, mc[4][b->filter][1],
|
||||
s->dst[0] + 4 * ls_y + 4, ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
(row << 3) + 4, (col << 3) + 4, &b->mv[3][1], 4, 4, w2, h2, 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int bwl = bwlog_tab[0][b->bs];
|
||||
int bw = bwh_tab[0][b->bs][0] * 4, bh = bwh_tab[0][b->bs][1] * 4;
|
||||
|
||||
mc_luma_dir(s, mc[bwl][b->filter][0], s->dst[0], ls_y,
|
||||
ref1->data[0], ref1->linesize[0], tref1,
|
||||
row << 3, col << 3, &b->mv[0][0],bw, bh, w1, h1, 0);
|
||||
|
||||
if (b->comp)
|
||||
mc_luma_dir(s, mc[bwl][b->filter][1], s->dst[0], ls_y,
|
||||
ref2->data[0], ref2->linesize[0], tref2,
|
||||
row << 3, col << 3, &b->mv[0][1], bw, bh, w2, h2, 1);
|
||||
}
|
||||
|
||||
// uv inter pred
|
||||
{
|
||||
int bwl = bwlog_tab[1][b->bs];
|
||||
int bw = bwh_tab[1][b->bs][0] * 4, bh = bwh_tab[1][b->bs][1] * 4;
|
||||
VP56mv mvuv;
|
||||
|
||||
w1 = (w1 + 1) >> 1;
|
||||
h1 = (h1 + 1) >> 1;
|
||||
if (b->comp) {
|
||||
w2 = (w2 + 1) >> 1;
|
||||
h2 = (h2 + 1) >> 1;
|
||||
}
|
||||
if (b->bs > BS_8x8) {
|
||||
mvuv.x = ROUNDED_DIV(b->mv[0][0].x + b->mv[1][0].x + b->mv[2][0].x + b->mv[3][0].x, 4);
|
||||
mvuv.y = ROUNDED_DIV(b->mv[0][0].y + b->mv[1][0].y + b->mv[2][0].y + b->mv[3][0].y, 4);
|
||||
} else {
|
||||
mvuv = b->mv[0][0];
|
||||
}
|
||||
|
||||
mc_chroma_dir(s, mc[bwl][b->filter][0],
|
||||
s->dst[1], s->dst[2], ls_uv,
|
||||
ref1->data[1], ref1->linesize[1],
|
||||
ref1->data[2], ref1->linesize[2], tref1,
|
||||
row << 2, col << 2, &mvuv, bw, bh, w1, h1, 0);
|
||||
|
||||
if (b->comp) {
|
||||
if (b->bs > BS_8x8) {
|
||||
mvuv.x = ROUNDED_DIV(b->mv[0][1].x + b->mv[1][1].x + b->mv[2][1].x + b->mv[3][1].x, 4);
|
||||
mvuv.y = ROUNDED_DIV(b->mv[0][1].y + b->mv[1][1].y + b->mv[2][1].y + b->mv[3][1].y, 4);
|
||||
} else {
|
||||
mvuv = b->mv[0][1];
|
||||
}
|
||||
mc_chroma_dir(s, mc[bwl][b->filter][1],
|
||||
s->dst[1], s->dst[2], ls_uv,
|
||||
ref2->data[1], ref2->linesize[1],
|
||||
ref2->data[2], ref2->linesize[2], tref2,
|
||||
row << 2, col << 2, &mvuv, bw, bh, w2, h2, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Michael Niedermayer
|
||||
* VP9 compatible video decoder
|
||||
*
|
||||
* Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
|
||||
* Copyright (C) 2013 Clément Bœsch <u pkh me>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
|
||||
+191
-14
@@ -1707,8 +1707,9 @@ copy_avg_fn(4)
|
||||
#undef fpel_fn
|
||||
#undef copy_avg_fn
|
||||
|
||||
static const int8_t vp9_subpel_filters[3][15][8] = {
|
||||
static const int16_t vp9_subpel_filters[3][16][8] = {
|
||||
[FILTER_8TAP_REGULAR] = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 },
|
||||
{ 0, 1, -5, 126, 8, -3, 1, 0 },
|
||||
{ -1, 3, -10, 122, 18, -6, 2, 0 },
|
||||
{ -1, 4, -13, 118, 27, -9, 3, -1 },
|
||||
@@ -1725,6 +1726,7 @@ static const int8_t vp9_subpel_filters[3][15][8] = {
|
||||
{ 0, 2, -6, 18, 122, -10, 3, -1 },
|
||||
{ 0, 1, -3, 8, 126, -5, 1, 0 },
|
||||
}, [FILTER_8TAP_SHARP] = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 },
|
||||
{ -1, 3, -7, 127, 8, -3, 1, 0 },
|
||||
{ -2, 5, -13, 125, 17, -6, 3, -1 },
|
||||
{ -3, 7, -17, 121, 27, -10, 5, -2 },
|
||||
@@ -1741,6 +1743,7 @@ static const int8_t vp9_subpel_filters[3][15][8] = {
|
||||
{ -1, 3, -6, 17, 125, -13, 5, -2 },
|
||||
{ 0, 1, -3, 8, 127, -7, 3, -1 },
|
||||
}, [FILTER_8TAP_SMOOTH] = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 },
|
||||
{ -3, -1, 32, 64, 38, 1, -3, 0 },
|
||||
{ -2, -2, 29, 63, 41, 2, -3, 0 },
|
||||
{ -2, -2, 26, 63, 43, 4, -4, 0 },
|
||||
@@ -1772,7 +1775,7 @@ static const int8_t vp9_subpel_filters[3][15][8] = {
|
||||
static av_always_inline void do_8tap_1d_c(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int w, int h, ptrdiff_t ds,
|
||||
const int8_t *filter, int avg)
|
||||
const int16_t *filter, int avg)
|
||||
{
|
||||
do {
|
||||
int x;
|
||||
@@ -1792,7 +1795,7 @@ static av_always_inline void do_8tap_1d_c(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
#define filter_8tap_1d_fn(opn, opa, dir, ds) \
|
||||
static av_noinline void opn##_8tap_1d_##dir##_c(uint8_t *dst, ptrdiff_t dst_stride, \
|
||||
const uint8_t *src, ptrdiff_t src_stride, \
|
||||
int w, int h, const int8_t *filter) \
|
||||
int w, int h, const int16_t *filter) \
|
||||
{ \
|
||||
do_8tap_1d_c(dst, dst_stride, src, src_stride, w, h, ds, filter, opa); \
|
||||
}
|
||||
@@ -1806,8 +1809,8 @@ filter_8tap_1d_fn(avg, 1, h, 1)
|
||||
|
||||
static av_always_inline void do_8tap_2d_c(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int w, int h, const int8_t *filterx,
|
||||
const int8_t *filtery, int avg)
|
||||
int w, int h, const int16_t *filterx,
|
||||
const int16_t *filtery, int avg)
|
||||
{
|
||||
int tmp_h = h + 7;
|
||||
uint8_t tmp[64 * 71], *tmp_ptr = tmp;
|
||||
@@ -1842,8 +1845,8 @@ static av_always_inline void do_8tap_2d_c(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
#define filter_8tap_2d_fn(opn, opa) \
|
||||
static av_noinline void opn##_8tap_2d_hv_c(uint8_t *dst, ptrdiff_t dst_stride, \
|
||||
const uint8_t *src, ptrdiff_t src_stride, \
|
||||
int w, int h, const int8_t *filterx, \
|
||||
const int8_t *filtery) \
|
||||
int w, int h, const int16_t *filterx, \
|
||||
const int16_t *filtery) \
|
||||
{ \
|
||||
do_8tap_2d_c(dst, dst_stride, src, src_stride, w, h, filterx, filtery, opa); \
|
||||
}
|
||||
@@ -1853,15 +1856,13 @@ filter_8tap_2d_fn(avg, 1)
|
||||
|
||||
#undef filter_8tap_2d_fn
|
||||
|
||||
#undef FILTER_8TAP
|
||||
|
||||
#define filter_fn_1d(sz, dir, dir_m, type, type_idx, avg) \
|
||||
static void avg##_8tap_##type##_##sz##dir##_c(uint8_t *dst, ptrdiff_t dst_stride, \
|
||||
const uint8_t *src, ptrdiff_t src_stride, \
|
||||
int h, int mx, int my) \
|
||||
{ \
|
||||
avg##_8tap_1d_##dir##_c(dst, dst_stride, src, src_stride, sz, h, \
|
||||
vp9_subpel_filters[type_idx][dir_m - 1]); \
|
||||
vp9_subpel_filters[type_idx][dir_m]); \
|
||||
}
|
||||
|
||||
#define filter_fn_2d(sz, type, type_idx, avg) \
|
||||
@@ -1870,8 +1871,8 @@ static void avg##_8tap_##type##_##sz##hv_c(uint8_t *dst, ptrdiff_t dst_stride, \
|
||||
int h, int mx, int my) \
|
||||
{ \
|
||||
avg##_8tap_2d_hv_c(dst, dst_stride, src, src_stride, sz, h, \
|
||||
vp9_subpel_filters[type_idx][mx - 1], \
|
||||
vp9_subpel_filters[type_idx][my - 1]); \
|
||||
vp9_subpel_filters[type_idx][mx], \
|
||||
vp9_subpel_filters[type_idx][my]); \
|
||||
}
|
||||
|
||||
#define FILTER_BILIN(src, x, mxy, stride) \
|
||||
@@ -1957,8 +1958,6 @@ bilin_2d_fn(avg, 1)
|
||||
|
||||
#undef bilin_2d_fn
|
||||
|
||||
#undef FILTER_BILIN
|
||||
|
||||
#define bilinf_fn_1d(sz, dir, dir_m, avg) \
|
||||
static void avg##_bilin_##sz##dir##_c(uint8_t *dst, ptrdiff_t dst_stride, \
|
||||
const uint8_t *src, ptrdiff_t src_stride, \
|
||||
@@ -2053,12 +2052,190 @@ static av_cold void vp9dsp_mc_init(VP9DSPContext *dsp)
|
||||
#undef init_subpel3
|
||||
}
|
||||
|
||||
static av_always_inline void do_scaled_8tap_c(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int w, int h, int mx, int my,
|
||||
int dx, int dy, int avg,
|
||||
const int16_t (*filters)[8])
|
||||
{
|
||||
int tmp_h = (((h - 1) * dy + my) >> 4) + 8;
|
||||
uint8_t tmp[64 * 135], *tmp_ptr = tmp;
|
||||
|
||||
src -= src_stride * 3;
|
||||
do {
|
||||
int x;
|
||||
int imx = mx, ioff = 0;
|
||||
|
||||
for (x = 0; x < w; x++) {
|
||||
tmp_ptr[x] = FILTER_8TAP(src, ioff, filters[imx], 1);
|
||||
imx += dx;
|
||||
ioff += imx >> 4;
|
||||
imx &= 0xf;
|
||||
}
|
||||
|
||||
tmp_ptr += 64;
|
||||
src += src_stride;
|
||||
} while (--tmp_h);
|
||||
|
||||
tmp_ptr = tmp + 64 * 3;
|
||||
do {
|
||||
int x;
|
||||
const int16_t *filter = filters[my];
|
||||
|
||||
for (x = 0; x < w; x++)
|
||||
if (avg) {
|
||||
dst[x] = (dst[x] + FILTER_8TAP(tmp_ptr, x, filter, 64) + 1) >> 1;
|
||||
} else {
|
||||
dst[x] = FILTER_8TAP(tmp_ptr, x, filter, 64);
|
||||
}
|
||||
|
||||
my += dy;
|
||||
tmp_ptr += (my >> 4) * 64;
|
||||
my &= 0xf;
|
||||
dst += dst_stride;
|
||||
} while (--h);
|
||||
}
|
||||
|
||||
#define scaled_filter_8tap_fn(opn, opa) \
|
||||
static av_noinline void opn##_scaled_8tap_c(uint8_t *dst, ptrdiff_t dst_stride, \
|
||||
const uint8_t *src, ptrdiff_t src_stride, \
|
||||
int w, int h, int mx, int my, int dx, int dy, \
|
||||
const int16_t (*filters)[8]) \
|
||||
{ \
|
||||
do_scaled_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
|
||||
opa, filters); \
|
||||
}
|
||||
|
||||
scaled_filter_8tap_fn(put, 0)
|
||||
scaled_filter_8tap_fn(avg, 1)
|
||||
|
||||
#undef scaled_filter_8tap_fn
|
||||
|
||||
#undef FILTER_8TAP
|
||||
|
||||
#define scaled_filter_fn(sz, type, type_idx, avg) \
|
||||
static void avg##_scaled_##type##_##sz##_c(uint8_t *dst, ptrdiff_t dst_stride, \
|
||||
const uint8_t *src, ptrdiff_t src_stride, \
|
||||
int h, int mx, int my, int dx, int dy) \
|
||||
{ \
|
||||
avg##_scaled_8tap_c(dst, dst_stride, src, src_stride, sz, h, mx, my, dx, dy, \
|
||||
vp9_subpel_filters[type_idx]); \
|
||||
}
|
||||
|
||||
static av_always_inline void do_scaled_bilin_c(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int w, int h, int mx, int my,
|
||||
int dx, int dy, int avg)
|
||||
{
|
||||
uint8_t tmp[64 * 129], *tmp_ptr = tmp;
|
||||
int tmp_h = (((h - 1) * dy + my) >> 4) + 2;
|
||||
|
||||
do {
|
||||
int x;
|
||||
int imx = mx, ioff = 0;
|
||||
|
||||
for (x = 0; x < w; x++) {
|
||||
tmp_ptr[x] = FILTER_BILIN(src, ioff, imx, 1);
|
||||
imx += dx;
|
||||
ioff += imx >> 4;
|
||||
imx &= 0xf;
|
||||
}
|
||||
|
||||
tmp_ptr += 64;
|
||||
src += src_stride;
|
||||
} while (--tmp_h);
|
||||
|
||||
tmp_ptr = tmp;
|
||||
do {
|
||||
int x;
|
||||
|
||||
for (x = 0; x < w; x++)
|
||||
if (avg) {
|
||||
dst[x] = (dst[x] + FILTER_BILIN(tmp_ptr, x, my, 64) + 1) >> 1;
|
||||
} else {
|
||||
dst[x] = FILTER_BILIN(tmp_ptr, x, my, 64);
|
||||
}
|
||||
|
||||
my += dy;
|
||||
tmp_ptr += (my >> 4) * 64;
|
||||
my &= 0xf;
|
||||
dst += dst_stride;
|
||||
} while (--h);
|
||||
}
|
||||
|
||||
#define scaled_bilin_fn(opn, opa) \
|
||||
static av_noinline void opn##_scaled_bilin_c(uint8_t *dst, ptrdiff_t dst_stride, \
|
||||
const uint8_t *src, ptrdiff_t src_stride, \
|
||||
int w, int h, int mx, int my, int dx, int dy) \
|
||||
{ \
|
||||
do_scaled_bilin_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, opa); \
|
||||
}
|
||||
|
||||
scaled_bilin_fn(put, 0)
|
||||
scaled_bilin_fn(avg, 1)
|
||||
|
||||
#undef scaled_bilin_fn
|
||||
|
||||
#undef FILTER_BILIN
|
||||
|
||||
#define scaled_bilinf_fn(sz, avg) \
|
||||
static void avg##_scaled_bilin_##sz##_c(uint8_t *dst, ptrdiff_t dst_stride, \
|
||||
const uint8_t *src, ptrdiff_t src_stride, \
|
||||
int h, int mx, int my, int dx, int dy) \
|
||||
{ \
|
||||
avg##_scaled_bilin_c(dst, dst_stride, src, src_stride, sz, h, mx, my, dx, dy); \
|
||||
}
|
||||
|
||||
#define scaled_filter_fns(sz, avg) \
|
||||
scaled_filter_fn(sz, regular, FILTER_8TAP_REGULAR, avg) \
|
||||
scaled_filter_fn(sz, smooth, FILTER_8TAP_SMOOTH, avg) \
|
||||
scaled_filter_fn(sz, sharp, FILTER_8TAP_SHARP, avg) \
|
||||
scaled_bilinf_fn(sz, avg)
|
||||
|
||||
#define scaled_filter_fn_set(avg) \
|
||||
scaled_filter_fns(64, avg) \
|
||||
scaled_filter_fns(32, avg) \
|
||||
scaled_filter_fns(16, avg) \
|
||||
scaled_filter_fns(8, avg) \
|
||||
scaled_filter_fns(4, avg)
|
||||
|
||||
scaled_filter_fn_set(put)
|
||||
scaled_filter_fn_set(avg)
|
||||
|
||||
#undef scaled_filter_fns
|
||||
#undef scaled_filter_fn_set
|
||||
#undef scaled_filter_fn
|
||||
#undef scaled_bilinf_fn
|
||||
|
||||
static av_cold void vp9dsp_scaled_mc_init(VP9DSPContext *dsp)
|
||||
{
|
||||
#define init_scaled(idx1, idx2, sz, type) \
|
||||
dsp->smc[idx1][FILTER_8TAP_SMOOTH ][idx2] = type##_scaled_smooth_##sz##_c; \
|
||||
dsp->smc[idx1][FILTER_8TAP_REGULAR][idx2] = type##_scaled_regular_##sz##_c; \
|
||||
dsp->smc[idx1][FILTER_8TAP_SHARP ][idx2] = type##_scaled_sharp_##sz##_c; \
|
||||
dsp->smc[idx1][FILTER_BILINEAR ][idx2] = type##_scaled_bilin_##sz##_c
|
||||
|
||||
#define init_scaled_put_avg(idx, sz) \
|
||||
init_scaled(idx, 0, sz, put); \
|
||||
init_scaled(idx, 1, sz, avg)
|
||||
|
||||
init_scaled_put_avg(0, 64);
|
||||
init_scaled_put_avg(1, 32);
|
||||
init_scaled_put_avg(2, 16);
|
||||
init_scaled_put_avg(3, 8);
|
||||
init_scaled_put_avg(4, 4);
|
||||
|
||||
#undef init_scaled_put_avg
|
||||
#undef init_scaled
|
||||
}
|
||||
|
||||
av_cold void ff_vp9dsp_init(VP9DSPContext *dsp)
|
||||
{
|
||||
vp9dsp_intrapred_init(dsp);
|
||||
vp9dsp_itxfm_init(dsp);
|
||||
vp9dsp_loopfilter_init(dsp);
|
||||
vp9dsp_mc_init(dsp);
|
||||
vp9dsp_scaled_mc_init(dsp);
|
||||
|
||||
if (ARCH_X86) ff_vp9dsp_init_x86(dsp);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
typedef void (*vp9_mc_func)(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *ref, ptrdiff_t ref_stride,
|
||||
int h, int mx, int my);
|
||||
typedef void (*vp9_scaled_mc_func)(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *ref, ptrdiff_t ref_stride,
|
||||
int h, int mx, int my, int dx, int dy);
|
||||
|
||||
typedef struct VP9DSPContext {
|
||||
/*
|
||||
@@ -109,6 +112,12 @@ typedef struct VP9DSPContext {
|
||||
* dst/stride are aligned by hsize
|
||||
*/
|
||||
vp9_mc_func mc[5][4][2][2][2];
|
||||
|
||||
/*
|
||||
* for scalable MC, first 3 dimensions identical to above, the other two
|
||||
* don't exist since it changes per stepsize.
|
||||
*/
|
||||
vp9_scaled_mc_func smc[5][4][2];
|
||||
} VP9DSPContext;
|
||||
|
||||
void ff_vp9dsp_init(VP9DSPContext *dsp);
|
||||
|
||||
@@ -128,6 +128,11 @@ static av_cold int wavpack_encode_init(AVCodecContext *avctx)
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
if (avctx->channels > 255) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid channel count: %d\n", avctx->channels);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (!avctx->frame_size) {
|
||||
int block_samples;
|
||||
if (!(avctx->sample_rate & 1))
|
||||
@@ -2882,7 +2887,7 @@ static int wavpack_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
}
|
||||
|
||||
buf_size = s->block_samples * avctx->channels * 8
|
||||
+ 200 /* for headers */;
|
||||
+ 200 * avctx->channels /* for headers */;
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, buf_size)) < 0)
|
||||
return ret;
|
||||
buf = avpkt->data;
|
||||
|
||||
+3
-1
@@ -32,6 +32,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
WMACodecContext *s = avctx->priv_data;
|
||||
int i, flags1, flags2, block_align;
|
||||
uint8_t *extradata;
|
||||
int ret;
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
@@ -82,7 +83,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
if (avctx->channels == 2)
|
||||
s->ms_stereo = 1;
|
||||
|
||||
ff_wma_init(avctx, flags2);
|
||||
if ((ret = ff_wma_init(avctx, flags2)) < 0)
|
||||
return ret;
|
||||
|
||||
/* init MDCT */
|
||||
for (i = 0; i < s->nb_block_sizes; i++)
|
||||
|
||||
@@ -300,6 +300,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
s->decode_flags = AV_RL16(edata_ptr+14);
|
||||
channel_mask = AV_RL32(edata_ptr+2);
|
||||
s->bits_per_sample = AV_RL16(edata_ptr);
|
||||
|
||||
if (s->bits_per_sample > 32 || s->bits_per_sample < 1) {
|
||||
avpriv_request_sample(avctx, "bits per sample is %d", s->bits_per_sample);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
/** dump the extradata */
|
||||
for (i = 0; i < avctx->extradata_size; i++)
|
||||
av_dlog(avctx, "[%x] ", avctx->extradata[i]);
|
||||
@@ -477,7 +483,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
/** calculate subwoofer cutoff values */
|
||||
for (i = 0; i < num_possible_block_sizes; i++) {
|
||||
int block_size = s->samples_per_frame >> i;
|
||||
int cutoff = (440*block_size + 3 * (s->avctx->sample_rate >> 1) - 1)
|
||||
int cutoff = (440*block_size + 3LL * (s->avctx->sample_rate >> 1) - 1)
|
||||
/ s->avctx->sample_rate;
|
||||
s->subwoofer_cutoffs[i] = av_clip(cutoff, 4, block_size);
|
||||
}
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (bytestream2_get_bytes_left(&gb) < ncolors * XWD_CMAP_SIZE + avctx->height * lsize) {
|
||||
if (bytestream2_get_bytes_left(&gb) < ncolors * XWD_CMAP_SIZE + (uint64_t)avctx->height * lsize) {
|
||||
av_log(avctx, AV_LOG_ERROR, "input buffer too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
|
||||
timestamp = movie->seek_point;
|
||||
// add the stream start time, should it exist
|
||||
if (movie->format_ctx->start_time != AV_NOPTS_VALUE) {
|
||||
if (timestamp > INT64_MAX - movie->format_ctx->start_time) {
|
||||
if (timestamp > 0 && movie->format_ctx->start_time > INT64_MAX - timestamp) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"%s: seek value overflow with start_time:%"PRId64" seek_point:%"PRId64"\n",
|
||||
movie->file_name, movie->format_ctx->start_time, movie->seek_point);
|
||||
|
||||
@@ -1174,7 +1174,9 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame,
|
||||
dummy.code = code;
|
||||
glyph = av_tree_find(s->glyphs, &dummy, glyph_cmp, NULL);
|
||||
if (!glyph) {
|
||||
load_glyph(ctx, &glyph, code);
|
||||
ret = load_glyph(ctx, &glyph, code);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
y_min = FFMIN(glyph->bbox.yMin, y_min);
|
||||
|
||||
@@ -120,10 +120,13 @@ static int decimate_frame(AVFilterContext *ctx,
|
||||
cur->data[plane], cur->linesize[plane],
|
||||
ref->data[plane], ref->linesize[plane],
|
||||
FF_CEIL_RSHIFT(ref->width, hsub),
|
||||
FF_CEIL_RSHIFT(ref->height, vsub)))
|
||||
FF_CEIL_RSHIFT(ref->height, vsub))) {
|
||||
emms_c();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
emms_c();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -523,6 +523,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
|
||||
sws_setColorspaceDetails(scale->isws[1], inv_table, in_full,
|
||||
table, out_full,
|
||||
brightness, contrast, saturation);
|
||||
|
||||
av_frame_set_color_range(out, out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG);
|
||||
}
|
||||
|
||||
av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den,
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ static int read_header(AVFormatContext *s)
|
||||
|
||||
avio_skip(pb, 16);
|
||||
size=avio_rl32(pb);
|
||||
ff_get_wav_header(pb, st->codec, size, 0);
|
||||
ff_get_wav_header(s, pb, st->codec, size, 0);
|
||||
|
||||
/*
|
||||
8000Hz (Fine-rec) file format has 10 bytes long
|
||||
|
||||
@@ -429,7 +429,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
|
||||
|
||||
st->codec->codec_type = type;
|
||||
if (type == AVMEDIA_TYPE_AUDIO) {
|
||||
int ret = ff_get_wav_header(pb, st->codec, type_specific_size, 0);
|
||||
int ret = ff_get_wav_header(s, pb, st->codec, type_specific_size, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (is_dvr_ms_audio) {
|
||||
|
||||
@@ -925,6 +925,11 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
|
||||
pts = (pkt->pts != AV_NOPTS_VALUE) ? pkt->pts : pkt->dts;
|
||||
av_assert0(pts != AV_NOPTS_VALUE);
|
||||
if ( pts < - PREROLL_TIME
|
||||
|| pts > (INT_MAX-3)/10000LL * ASF_INDEXED_INTERVAL - PREROLL_TIME) {
|
||||
av_log(s, AV_LOG_ERROR, "input pts %"PRId64" is invalid\n", pts);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
pts *= 10000;
|
||||
asf->duration = FFMAX(asf->duration, pts + pkt->duration * 10000);
|
||||
|
||||
|
||||
+20
-8
@@ -78,6 +78,18 @@
|
||||
* if its AVClass is non-NULL, and the protocols layer. See the discussion on
|
||||
* nesting in @ref avoptions documentation to learn how to access those.
|
||||
*
|
||||
* @section urls
|
||||
* URL strings in libavformat are made of a scheme/protocol, a ':', and a
|
||||
* scheme specific string. URLs without a scheme and ':' used for local files
|
||||
* are supported but deprecated. "file:" should be used for local files.
|
||||
*
|
||||
* It is important that the scheme string is not taken from untrusted
|
||||
* sources without checks.
|
||||
*
|
||||
* Note that some schemes/protocols are quite powerful, allowing access to
|
||||
* both local and remote files, parts of them, concatenations of them, local
|
||||
* audio and video devices and so on.
|
||||
*
|
||||
* @defgroup lavf_decoding Demuxing
|
||||
* @{
|
||||
* Demuxers read a media file and split it into chunks of data (@em packets). A
|
||||
@@ -88,10 +100,10 @@
|
||||
* cleanup.
|
||||
*
|
||||
* @section lavf_decoding_open Opening a media file
|
||||
* The minimum information required to open a file is its URL or filename, which
|
||||
* The minimum information required to open a file is its URL, which
|
||||
* is passed to avformat_open_input(), as in the following code:
|
||||
* @code
|
||||
* const char *url = "in.mp3";
|
||||
* const char *url = "file:in.mp3";
|
||||
* AVFormatContext *s = NULL;
|
||||
* int ret = avformat_open_input(&s, url, NULL, NULL);
|
||||
* if (ret < 0)
|
||||
@@ -921,7 +933,7 @@ typedef struct AVStream {
|
||||
/**
|
||||
* Stream information used internally by av_find_stream_info()
|
||||
*/
|
||||
#define MAX_STD_TIMEBASES (30*12+7+6)
|
||||
#define MAX_STD_TIMEBASES (30*12+30+3+6)
|
||||
struct {
|
||||
int64_t last_dts;
|
||||
int64_t duration_gcd;
|
||||
@@ -1955,7 +1967,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score
|
||||
*
|
||||
* @param pb the bytestream to probe
|
||||
* @param fmt the input format is put here
|
||||
* @param filename the filename of the stream
|
||||
* @param url the url of the stream
|
||||
* @param logctx the log context
|
||||
* @param offset the offset within the bytestream to probe from
|
||||
* @param max_probe_size the maximum probe buffer size (zero for default)
|
||||
@@ -1964,14 +1976,14 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score
|
||||
* AVERROR code otherwise
|
||||
*/
|
||||
int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt,
|
||||
const char *filename, void *logctx,
|
||||
const char *url, void *logctx,
|
||||
unsigned int offset, unsigned int max_probe_size);
|
||||
|
||||
/**
|
||||
* Like av_probe_input_buffer2() but returns 0 on success
|
||||
*/
|
||||
int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
|
||||
const char *filename, void *logctx,
|
||||
const char *url, void *logctx,
|
||||
unsigned int offset, unsigned int max_probe_size);
|
||||
|
||||
/**
|
||||
@@ -1982,7 +1994,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
|
||||
* May be a pointer to NULL, in which case an AVFormatContext is allocated by this
|
||||
* function and written into ps.
|
||||
* Note that a user-supplied AVFormatContext will be freed on failure.
|
||||
* @param filename Name of the stream to open.
|
||||
* @param url URL of the stream to open.
|
||||
* @param fmt If non-NULL, this parameter forces a specific input format.
|
||||
* Otherwise the format is autodetected.
|
||||
* @param options A dictionary filled with AVFormatContext and demuxer-private options.
|
||||
@@ -1993,7 +2005,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
|
||||
*
|
||||
* @note If you want to use custom IO, preallocate the format context and set its pb field.
|
||||
*/
|
||||
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options);
|
||||
int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options);
|
||||
|
||||
attribute_deprecated
|
||||
int av_demuxer_open(AVFormatContext *ic);
|
||||
|
||||
@@ -829,7 +829,7 @@ static int avi_read_header(AVFormatContext *s)
|
||||
// avio_skip(pb, size - 5 * 4);
|
||||
break;
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
ret = ff_get_wav_header(pb, st->codec, size, 0);
|
||||
ret = ff_get_wav_header(s, pb, st->codec, size, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ast->dshow_block_align = st->codec->block_align;
|
||||
|
||||
+9
-2
@@ -155,9 +155,16 @@ static int url_alloc_for_protocol(URLContext **puc, struct URLProtocol *up,
|
||||
char sep= *++p;
|
||||
char *key, *val;
|
||||
p++;
|
||||
|
||||
if (strcmp(up->name, "subfile"))
|
||||
ret = AVERROR(EINVAL);
|
||||
|
||||
while(ret >= 0 && (key= strchr(p, sep)) && p<key && (val = strchr(key+1, sep))){
|
||||
*val= *key= 0;
|
||||
ret= av_opt_set(uc->priv_data, p, key+1, 0);
|
||||
if (strcmp(p, "start") && strcmp(p, "end")) {
|
||||
ret = AVERROR_OPTION_NOT_FOUND;
|
||||
} else
|
||||
ret= av_opt_set(uc->priv_data, p, key+1, 0);
|
||||
if (ret == AVERROR_OPTION_NOT_FOUND)
|
||||
av_log(uc, AV_LOG_ERROR, "Key '%s' not found.\n", p);
|
||||
*val= *key= sep;
|
||||
@@ -222,7 +229,7 @@ static struct URLProtocol *url_find_protocol(const char *filename)
|
||||
size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
|
||||
|
||||
if (filename[proto_len] != ':' &&
|
||||
(filename[proto_len] != ',' || !strchr(filename + proto_len + 1, ':')) ||
|
||||
(strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':')) ||
|
||||
is_dos_path(filename))
|
||||
strcpy(proto_str, "file");
|
||||
else
|
||||
|
||||
@@ -359,6 +359,8 @@ static inline int put_str16(AVIOContext *s, const char *str, const int be)
|
||||
invalid:
|
||||
av_log(s, AV_LOG_ERROR, "Invaid UTF8 sequence in avio_put_str16%s\n", be ? "be" : "le");
|
||||
err = AVERROR(EINVAL);
|
||||
if (!*(q-1))
|
||||
break;
|
||||
}
|
||||
if (be)
|
||||
avio_wb16(s, 0);
|
||||
|
||||
@@ -260,6 +260,16 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (codec->codec_id == AV_CODEC_ID_ADPCM_THP) {
|
||||
uint8_t *dst;
|
||||
|
||||
if (!b->adpc) {
|
||||
av_log(s, AV_LOG_ERROR, "adpcm_thp requires ADPC chunk, but none was found.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (!b->table) {
|
||||
b->table = av_mallocz(32 * codec->channels);
|
||||
if (!b->table)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
if (av_new_packet(pkt, 8 + (32 + 4) * codec->channels + size) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
dst = pkt->data;
|
||||
|
||||
@@ -282,6 +282,12 @@ resolve_eof:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int enu_free(void *opaque, void *elem)
|
||||
{
|
||||
av_free(elem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cache_close(URLContext *h)
|
||||
{
|
||||
Context *c= h->priv_data;
|
||||
@@ -291,6 +297,7 @@ static int cache_close(URLContext *h)
|
||||
|
||||
close(c->fd);
|
||||
ffurl_close(c->inner);
|
||||
av_tree_enumerate(c->root, NULL, NULL, enu_free);
|
||||
av_tree_destroy(c->root);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -65,7 +65,10 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags)
|
||||
struct concat_data *data = h->priv_data;
|
||||
struct concat_nodes *nodes;
|
||||
|
||||
av_strstart(uri, "concat:", &uri);
|
||||
if (!av_strstart(uri, "concat:", &uri)) {
|
||||
av_log(h, AV_LOG_ERROR, "URL %s lacks prefix\n", uri);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
for (i = 0, len = 1; uri[i]; i++) {
|
||||
if (uri[i] == *AV_CAT_SEPARATOR) {
|
||||
|
||||
@@ -625,7 +625,7 @@ static int concat_seek(AVFormatContext *avf, int stream,
|
||||
|
||||
static const AVOption options[] = {
|
||||
{ "safe", "enable safe mode",
|
||||
OFFSET(safe), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, DEC },
|
||||
OFFSET(safe), AV_OPT_TYPE_INT, {.i64 = 1}, -1, 1, DEC },
|
||||
{ "auto_convert", "automatically convert bitstream format",
|
||||
OFFSET(auto_convert), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC },
|
||||
{ NULL }
|
||||
|
||||
+1
-1
@@ -444,7 +444,7 @@ void av_dump_format(AVFormatContext *ic, int index,
|
||||
av_log(NULL, AV_LOG_INFO, " Duration: ");
|
||||
if (ic->duration != AV_NOPTS_VALUE) {
|
||||
int hours, mins, secs, us;
|
||||
int64_t duration = ic->duration + 5000;
|
||||
int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0);
|
||||
secs = duration / AV_TIME_BASE;
|
||||
us = duration % AV_TIME_BASE;
|
||||
mins = secs / 60;
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ static int dxa_read_header(AVFormatContext *s)
|
||||
ast = avformat_new_stream(s, NULL);
|
||||
if (!ast)
|
||||
return AVERROR(ENOMEM);
|
||||
ret = ff_get_wav_header(pb, ast->codec, fsize, 0);
|
||||
ret = ff_get_wav_header(s, pb, ast->codec, fsize, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ast->codec->sample_rate > 0)
|
||||
|
||||
+47
-5
@@ -26,6 +26,7 @@
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "avformat.h"
|
||||
#include "internal.h"
|
||||
#include "ffm.h"
|
||||
@@ -113,9 +114,10 @@ static int ffm_read_data(AVFormatContext *s,
|
||||
ffm->dts = avio_rb64(pb);
|
||||
frame_offset = avio_rb16(pb);
|
||||
avio_read(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
|
||||
ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
|
||||
if (ffm->packet_end < ffm->packet || frame_offset < 0)
|
||||
if (ffm->packet_size < FFM_HEADER_SIZE + fill_size || frame_offset < 0) {
|
||||
return -1;
|
||||
}
|
||||
ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
|
||||
/* if first packet or resynchronization packet, we must
|
||||
handle it specifically */
|
||||
if (ffm->first_packet || (frame_offset & 0x8000)) {
|
||||
@@ -131,8 +133,10 @@ static int ffm_read_data(AVFormatContext *s,
|
||||
return 0;
|
||||
}
|
||||
ffm->first_packet = 0;
|
||||
if ((frame_offset & 0x7fff) < FFM_HEADER_SIZE)
|
||||
if ((frame_offset & 0x7fff) < FFM_HEADER_SIZE) {
|
||||
ffm->packet_end = ffm->packet_ptr;
|
||||
return -1;
|
||||
}
|
||||
ffm->packet_ptr = ffm->packet + (frame_offset & 0x7fff) - FFM_HEADER_SIZE;
|
||||
if (!header)
|
||||
break;
|
||||
@@ -267,6 +271,7 @@ static int ffm2_read_header(AVFormatContext *s)
|
||||
AVStream *st;
|
||||
AVIOContext *pb = s->pb;
|
||||
AVCodecContext *codec;
|
||||
const AVCodecDescriptor *codec_desc;
|
||||
int ret;
|
||||
int f_main = 0, f_cprv = -1, f_stvi = -1, f_stau = -1;
|
||||
AVCodec *enc;
|
||||
@@ -321,7 +326,20 @@ static int ffm2_read_header(AVFormatContext *s)
|
||||
codec = st->codec;
|
||||
/* generic info */
|
||||
codec->codec_id = avio_rb32(pb);
|
||||
codec_desc = avcodec_descriptor_get(codec->codec_id);
|
||||
if (!codec_desc) {
|
||||
av_log(s, AV_LOG_ERROR, "Invalid codec id: %d\n", codec->codec_id);
|
||||
codec->codec_id = AV_CODEC_ID_NONE;
|
||||
goto fail;
|
||||
}
|
||||
codec->codec_type = avio_r8(pb);
|
||||
if (codec->codec_type != codec_desc->type) {
|
||||
av_log(s, AV_LOG_ERROR, "Codec type mismatch: expected %d, found %d\n",
|
||||
codec_desc->type, codec->codec_type);
|
||||
codec->codec_id = AV_CODEC_ID_NONE;
|
||||
codec->codec_type = AVMEDIA_TYPE_UNKNOWN;
|
||||
goto fail;
|
||||
}
|
||||
codec->bit_rate = avio_rb32(pb);
|
||||
codec->flags = avio_rb32(pb);
|
||||
codec->flags2 = avio_rb32(pb);
|
||||
@@ -348,6 +366,11 @@ static int ffm2_read_header(AVFormatContext *s)
|
||||
codec->height = avio_rb16(pb);
|
||||
codec->gop_size = avio_rb16(pb);
|
||||
codec->pix_fmt = avio_rb32(pb);
|
||||
if (!av_pix_fmt_desc_get(codec->pix_fmt)) {
|
||||
av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt);
|
||||
codec->pix_fmt = AV_PIX_FMT_NONE;
|
||||
goto fail;
|
||||
}
|
||||
codec->qmin = avio_r8(pb);
|
||||
codec->qmax = avio_r8(pb);
|
||||
codec->max_qdiff = avio_r8(pb);
|
||||
@@ -414,7 +437,7 @@ static int ffm2_read_header(AVFormatContext *s)
|
||||
}
|
||||
break;
|
||||
case MKBETAG('S', '2', 'V', 'I'):
|
||||
if (f_stvi++) {
|
||||
if (f_stvi++ || !size) {
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
@@ -429,7 +452,7 @@ static int ffm2_read_header(AVFormatContext *s)
|
||||
goto fail;
|
||||
break;
|
||||
case MKBETAG('S', '2', 'A', 'U'):
|
||||
if (f_stau++) {
|
||||
if (f_stau++ || !size) {
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
@@ -469,6 +492,7 @@ static int ffm_read_header(AVFormatContext *s)
|
||||
AVStream *st;
|
||||
AVIOContext *pb = s->pb;
|
||||
AVCodecContext *codec;
|
||||
const AVCodecDescriptor *codec_desc;
|
||||
int i, nb_streams;
|
||||
uint32_t tag;
|
||||
|
||||
@@ -506,7 +530,20 @@ static int ffm_read_header(AVFormatContext *s)
|
||||
codec = st->codec;
|
||||
/* generic info */
|
||||
codec->codec_id = avio_rb32(pb);
|
||||
codec_desc = avcodec_descriptor_get(codec->codec_id);
|
||||
if (!codec_desc) {
|
||||
av_log(s, AV_LOG_ERROR, "Invalid codec id: %d\n", codec->codec_id);
|
||||
codec->codec_id = AV_CODEC_ID_NONE;
|
||||
goto fail;
|
||||
}
|
||||
codec->codec_type = avio_r8(pb); /* codec_type */
|
||||
if (codec->codec_type != codec_desc->type) {
|
||||
av_log(s, AV_LOG_ERROR, "Codec type mismatch: expected %d, found %d\n",
|
||||
codec_desc->type, codec->codec_type);
|
||||
codec->codec_id = AV_CODEC_ID_NONE;
|
||||
codec->codec_type = AVMEDIA_TYPE_UNKNOWN;
|
||||
goto fail;
|
||||
}
|
||||
codec->bit_rate = avio_rb32(pb);
|
||||
codec->flags = avio_rb32(pb);
|
||||
codec->flags2 = avio_rb32(pb);
|
||||
@@ -525,6 +562,11 @@ static int ffm_read_header(AVFormatContext *s)
|
||||
codec->height = avio_rb16(pb);
|
||||
codec->gop_size = avio_rb16(pb);
|
||||
codec->pix_fmt = avio_rb32(pb);
|
||||
if (!av_pix_fmt_desc_get(codec->pix_fmt)) {
|
||||
av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt);
|
||||
codec->pix_fmt = AV_PIX_FMT_NONE;
|
||||
goto fail;
|
||||
}
|
||||
codec->qmin = avio_r8(pb);
|
||||
codec->qmax = avio_r8(pb);
|
||||
codec->max_qdiff = avio_r8(pb);
|
||||
|
||||
@@ -911,6 +911,23 @@ static void update_options(char **dest, const char *name, void *src)
|
||||
av_freep(dest);
|
||||
}
|
||||
|
||||
static int check_url(const char *url) {
|
||||
const char *proto_name = avio_find_protocol_name(url);
|
||||
|
||||
if (!proto_name)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (!av_strstart(proto_name, "http", NULL) && !av_strstart(proto_name, "file", NULL))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (!strncmp(proto_name, url, strlen(proto_name)) && url[strlen(proto_name)] == ':')
|
||||
return 0;
|
||||
else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int open_input(HLSContext *c, struct playlist *pls)
|
||||
{
|
||||
AVDictionary *opts = NULL;
|
||||
@@ -938,6 +955,10 @@ static int open_input(HLSContext *c, struct playlist *pls)
|
||||
seg->url, seg->url_offset, pls->index);
|
||||
|
||||
if (seg->key_type == KEY_NONE) {
|
||||
ret = check_url(seg->url);
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = ffurl_open(&pls->input, seg->url, AVIO_FLAG_READ,
|
||||
&pls->parent->interrupt_callback, &opts);
|
||||
|
||||
@@ -945,6 +966,10 @@ static int open_input(HLSContext *c, struct playlist *pls)
|
||||
char iv[33], key[33], url[MAX_URL_SIZE];
|
||||
if (strcmp(seg->key, pls->key_url)) {
|
||||
URLContext *uc;
|
||||
ret = check_url(seg->key);
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (ffurl_open(&uc, seg->key, AVIO_FLAG_READ,
|
||||
&pls->parent->interrupt_callback, &opts2) == 0) {
|
||||
if (ffurl_read_complete(uc, pls->key, sizeof(pls->key))
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user