Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| da2186be81 |
@@ -1 +0,0 @@
|
||||
*.pnm -diff -text
|
||||
@@ -2,175 +2,6 @@ Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
|
||||
|
||||
version 2.4.6:
|
||||
- doc/examples: fix lib math dep for decoding_encoding
|
||||
- avformat/movenc: workaround bug in "PathScale EKOPath(tm) Compiler Suite Version 4.0.12.1"
|
||||
- vp9: fix parser return values in error case
|
||||
- ffmpeg: Clear error message array at init.
|
||||
- avcodec/dvdsubdec: fix accessing dangling pointers
|
||||
- avcodec/dvdsubdec: error on bitmaps with size 0
|
||||
- avformat/mov: Fix mixed declaration and statement warning
|
||||
- cmdutils: Use 64bit for file size/offset related variable in cmdutils_read_file()
|
||||
- avformat/utils: Clear pointer in ff_alloc_extradata() to avoid leaving a stale pointer in memory
|
||||
- avformat/matroskadec: Use av_freep() to avoid leaving stale pointers in memory
|
||||
- lavfi: check av_strdup() return value
|
||||
- mov: Fix negative size calculation in mov_read_default().
|
||||
- avformat/mov: fix integer overflow in mov_read_udta_string()
|
||||
- mov: Avoid overflow with mov_metadata_raw()
|
||||
- avcodec/dvdsubdec: fix out of bounds accesses
|
||||
- avfilter/vf_sab: fix filtering tiny images
|
||||
- avformat/flvdec: Increase string array size
|
||||
- avformat/flvdec: do not inject dts=0 metadata packets which failed to be parsed into a new data stream
|
||||
- avformat/cdxl: Fix integer overflow of image_size
|
||||
- avformat/segment: Use av_freep() avoid leaving stale pointers in memory
|
||||
- avformat/mov: Fix memleaks for duplicate STCO/CO64/STSC atoms
|
||||
- mov: avoid a memleak when multiple stss boxes are presen
|
||||
|
||||
version 2.4.5:
|
||||
- lavu/frame: fix malloc error path in av_frame_copy_props()
|
||||
- avformat/utils: Do not update programs streams from program-less streams in update_wrap_reference()
|
||||
- avformat/aviobuf: Check that avio_seek() target is non negative
|
||||
- swresample/soxr_resample: fix error handling
|
||||
- avformat/flvdec: fix potential use of uninitialized variables
|
||||
- avformat/matroskadec: fix handling of recursive SeekHead elements
|
||||
- doc/examples/transcoding: check encoder before using it
|
||||
- swscale/x86/rgb2rgb_template: fix crash with tiny size and nv12 output
|
||||
- avformat/rmdec: Check codec_data_size
|
||||
- avformat/aviobuf: Fix infinite loop in ff_get_line()
|
||||
- vc1: Do not assume seek happens after decoding
|
||||
- mmvideo: check frame dimensions
|
||||
- jvdec: check frame dimensions
|
||||
- avcodec/indeo3: ensure offsets are non negative
|
||||
- avcodec/h264: Check *log2_weight_denom
|
||||
- avcodec/hevc_ps: Check diff_cu_qp_delta_depth
|
||||
- avcodec/h264: Clear delayed_pic on deallocation
|
||||
- avcodec/hevc: clear filter_slice_edges() on allocation
|
||||
- avcodec/dcadec: Check that the added xch channel isnt already there
|
||||
- avcodec/indeo3: use signed variables to avoid underflow
|
||||
- swscale: increase yuv2rgb table headroom
|
||||
- avformat/mov: fix integer overflow of size
|
||||
- avformat/mov: check atom nesting depth
|
||||
- avcodec/utvideodec: Fix handling of slice_height=0
|
||||
- avcodec/vmdvideo: Check len before using it in method 3
|
||||
- avformat/flvdec: Use av_freep() avoid leaving stale pointers in memory
|
||||
- avformat/hdsenc: Use av_freep() avoid leaving stale pointers in memory
|
||||
- configure: create the tests directory like the doc directory
|
||||
- v4l2: Make use of the VIDIOC_ENUM_FRAMESIZES ioctl on OpenBSD
|
||||
- avcodec/motion_est: use 2x8x8 for interlaced qpel
|
||||
- Treat all '*.pnm' files as non-text file
|
||||
|
||||
version 2.4.4:
|
||||
- avformat: replace some odd 30-60 rates by higher less odd ones in get_std_framerate()
|
||||
- swscale: fix yuv2yuvX_8 assembly on x86
|
||||
- avcodec/hevc_ps: Check num_long_term_ref_pics_sps
|
||||
- avcodec/mjpegdec: Fix integer overflow in shift
|
||||
- avcodec/hevc_ps: Check return code from pps_range_extensions()
|
||||
- avcodec/rawdec: Check the return code of avpicture_get_size()
|
||||
- avcodec/pngdec: Check IHDR/IDAT order
|
||||
- avcodec/flacdec: Call ff_flacdsp_init() unconditionally
|
||||
- avcodec/utils: Check that the data is complete in avpriv_bprint_to_extradata()
|
||||
- avcodec/mjpegdec: Fix context fields becoming inconsistent
|
||||
- avcodec/mjpegdec: Check for pixfmtid 0x42111100 || 0x24111100 with more than 8 bits
|
||||
- swscale/x86/rgb2rgb_template: handle the first 2 lines with C in rgb24toyv12_*()
|
||||
- doc/APIchanges: Fix some wrong versions
|
||||
- avformat/hlsenc: Free context after hls_append_segment
|
||||
- avcodec/mpeg4video_parser: fix spurious extradata parse warnings
|
||||
- lavu/opt: fix av_opt_get function
|
||||
- avcodec/wmaprodec: Fix integer overflow in sfb_offsets initialization
|
||||
- avcodec/utvideodec: fix assumtation that slice_height >= 1
|
||||
- avcodec/options_table fix min of audio channels and sample rate
|
||||
- libavutil/thread.h: Support OS/2 threads
|
||||
- fix Makefile objects for pulseaudio support
|
||||
- opusdec: make sure all substreams have the same number of coded samples
|
||||
- lavu: add wrappers for the pthreads mutex API
|
||||
- avformat/avidec: fix handling dv in avi
|
||||
- avfilter/vf_lut: gammaval709()
|
||||
- cinedec: report white balance gain coefficients using metadata
|
||||
- swscale/utils: support bayer input + scaling, and bayer input + any supported output
|
||||
- swscale: support internal scaler cascades
|
||||
- avformat/dtsdec: dts_probe: check reserved bit, check lfe, check sr_code similarity
|
||||
- avformat/segment: export inner muxer timebase
|
||||
- Remove fminf() emulation, fix build issues
|
||||
- avcodec/mpegaudio_parser: fix off by 1 error in bitrate calculation
|
||||
- Use -fno-optimize-sibling-calls on parisc also for gcc 4.9.
|
||||
- ffmpeg_opt: store canvas size in decoder context
|
||||
- avcodec/mpeg12dec: do not trust AVCodecContext input dimensions
|
||||
|
||||
version 2.4.3:
|
||||
- avcodec/svq1dec: zero terminate embedded message before printing
|
||||
- avcodec/cook: check that the subpacket sizes fit in block_align
|
||||
- avcodec/g2meet: check tile dimensions to avoid integer overflow
|
||||
- avcodec/utils: Align dimensions by at least their chroma sub-sampling factors.
|
||||
- avcodec/dnxhddec: treat pix_fmt like width/height
|
||||
- avcodec/dxa: check dimensions
|
||||
- avcodec/dirac_arith: fix integer overflow
|
||||
- avcodec/diracdec: Tighter checks on CODEBLOCKS_X/Y
|
||||
- avcodec/diracdec: Use 64bit in calculation of codeblock coordinates
|
||||
- avcodec/sgidec: fix count check
|
||||
- avcodec/sgidec: fix linesize for 16bit
|
||||
- avcodec/hevc_ps: Check default display window bitstream and skip if invalid
|
||||
- avcodec/tiffenc: properly compute packet size
|
||||
- lavd: export all symbols with av_ prefix
|
||||
- avformat/mxfdec: Fix termination of mxf_data_essence_container_uls
|
||||
- postproc: fix qp count
|
||||
- postproc/postprocess: fix quant store for fq mode
|
||||
- vf_drawtext: add missing clear of pointers after av_expr_free()
|
||||
- utvideoenc: properly set slice height/last line
|
||||
- swresample: fix sample drop loop end condition
|
||||
- resample: Avoid off-by-1 errors in PTS calcs.
|
||||
- imc: fix order of operations in coefficients read
|
||||
- hevc_mvs: make sure to always initialize the temporal MV fully
|
||||
- hevc_mvs: initialize the temporal MV in case of missing reference
|
||||
|
||||
version 2.4.2:
|
||||
- avcodec/on2avc: Check number of channels
|
||||
- avcodec/hevc: fix chroma transform_add size
|
||||
- avcodec/h264: Check mode before considering mixed mode intra prediction
|
||||
- avformat/mpegts: use a padded buffer in read_sl_header()
|
||||
- avformat/mpegts: Check desc_len / get8() return code
|
||||
- avcodec/vorbisdec: Fix off by 1 error in ptns_to_read
|
||||
- sdp: add support for H.261
|
||||
- avcodec/svq3: Do not memcpy AVFrame
|
||||
- avcodec/smc: fix off by 1 error
|
||||
- avcodec/qpeg: fix off by 1 error in MV bounds check
|
||||
- avcodec/gifdec: factorize interleave end handling out
|
||||
- avcodec/cinepak: fix integer underflow
|
||||
- avcodec/pngdec: Check bits per pixel before setting monoblack pixel format
|
||||
- avcodec/pngdec: Calculate MPNG bytewidth more defensively
|
||||
- avcodec/tiff: more completely check bpp/bppcount
|
||||
- avcodec/mmvideo: Bounds check 2nd line of HHV Intra blocks
|
||||
- avcodec/h263dec: Fix decoding messenger.h263
|
||||
- avcodec/utils: Add case for jv to avcodec_align_dimensions2()
|
||||
- avcodec/mjpegdec: check bits per pixel for changes similar to dimensions
|
||||
- avcodec/jpeglsdec: Check run value more completely in ls_decode_line()
|
||||
- avformat/hlsenc: export inner muxer timebase
|
||||
- configure: add noexecstack to linker options if supported.
|
||||
- avcodec/ac3enc_template: fix out of array read
|
||||
- avutil/x86/cpu: fix cpuid sub-leaf selection
|
||||
- avformat/img2dec: enable generic seeking for image pipes
|
||||
- avformat/img2dec: initialize pkt->pos for image pipes
|
||||
- avformat/img2dec: pass error code and signal EOF
|
||||
- avformat/img2dec: fix error code at EOF for pipes
|
||||
- libavutil/opt: fix av_opt_set_channel_layout() to access correct memory address
|
||||
- tests/fate-run.sh: Cat .err file in case of error with V>0
|
||||
- avformat/riffenc: Filter out "BottomUp" in ff_put_bmp_header()
|
||||
- avcodec/webp: fix default palette color 0xff000000 -> 0x00000000
|
||||
- avcodec/asvenc: fix AAN scaling
|
||||
- Fix compile error on arm4/arm5 platform
|
||||
|
||||
|
||||
version 2.4.1:
|
||||
- swscale: Allow chroma samples to be above and to the left of luma samples
|
||||
- avcodec/libilbc: support for latest git of libilbc
|
||||
- avcodec/webp: treat out-of-bound palette index as translucent black
|
||||
- vf_deshake: rename Transform.vector to Transform.vec to avoid compiler confusion
|
||||
- apetag: Fix APE tag size check
|
||||
- tools/crypto_bench: fix build when AV_READ_TIME is unavailable
|
||||
|
||||
|
||||
version 2.4:
|
||||
- Icecast protocol
|
||||
- ported lenscorrection filter from frei0r filter
|
||||
- large optimizations in dctdnoiz to make it usable
|
||||
|
||||
@@ -111,7 +111,7 @@ endef
|
||||
|
||||
$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(PROGSSUF)$(EXESUF)=))))
|
||||
|
||||
ffprobe.o cmdutils.o libavcodec/utils.o libavformat/utils.o libavdevice/avdevice.o libavfilter/avfilter.o libavutil/utils.o libpostproc/postprocess.o libswresample/swresample.o libswscale/utils.o : libavutil/ffversion.h
|
||||
ffprobe.o cmdutils.o : libavutil/ffversion.h
|
||||
|
||||
$(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
|
||||
$(CP) $< $@
|
||||
|
||||
@@ -53,8 +53,6 @@
|
||||
• API for live metadata updates through event flags.
|
||||
• UTF-16 support in text subtitles formats.
|
||||
• The ASS muxer now reorders the Dialogue events properly.
|
||||
• support for H.261 RTP payload format (RFC 4587)
|
||||
• HEVC/H.265 RTP payload format (draft v6) depacketizer
|
||||
|
||||
┌────────────────────────────┐
|
||||
│ libavfilter │
|
||||
|
||||
+1
-1
@@ -1857,7 +1857,7 @@ int read_yesno(void)
|
||||
|
||||
int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
|
||||
{
|
||||
int64_t ret;
|
||||
int ret;
|
||||
FILE *f = av_fopen_utf8(filename, "rb");
|
||||
|
||||
if (!f) {
|
||||
|
||||
@@ -1668,6 +1668,7 @@ MATH_FUNCS="
|
||||
exp2
|
||||
exp2f
|
||||
expf
|
||||
fminf
|
||||
isinf
|
||||
isnan
|
||||
ldexpf
|
||||
@@ -3933,9 +3934,6 @@ case "$arch" in
|
||||
;;
|
||||
x86)
|
||||
check_64bit x86_32 x86_64 'sizeof(void *) > 4'
|
||||
# Treat x32 as x64 for now. Note it also needs spic=$shared
|
||||
test "$subarch" = "x86_32" && check_cpp_condition stddef.h 'defined(__x86_64__)' &&
|
||||
subarch=x86_64
|
||||
if test "$subarch" = "x86_64"; then
|
||||
spic=$shared
|
||||
fi
|
||||
@@ -4502,7 +4500,7 @@ elif enabled parisc; then
|
||||
|
||||
if enabled gcc; then
|
||||
case $($cc -dumpversion) in
|
||||
4.[3-9].*) check_cflags -fno-optimize-sibling-calls ;;
|
||||
4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -4610,7 +4608,6 @@ fi
|
||||
check_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon
|
||||
|
||||
check_ldflags -Wl,--as-needed
|
||||
check_ldflags -Wl,-z,noexecstack
|
||||
|
||||
if check_func dlopen; then
|
||||
ldl=
|
||||
@@ -4784,6 +4781,7 @@ disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersi
|
||||
atan2f_args=2
|
||||
ldexpf_args=2
|
||||
powf_args=2
|
||||
fminf_args=2
|
||||
|
||||
for func in $MATH_FUNCS; do
|
||||
eval check_mathfunc $func \${${func}_args:-1}
|
||||
@@ -4944,7 +4942,6 @@ check_header linux/videodev2.h
|
||||
check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
|
||||
|
||||
check_header sys/videoio.h
|
||||
check_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
|
||||
|
||||
check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
|
||||
# check that WM_CAP_DRIVER_CONNECT is defined to the proper value
|
||||
@@ -5600,7 +5597,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 2014
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
@@ -5628,7 +5625,6 @@ enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
|
||||
|
||||
|
||||
mkdir -p doc
|
||||
mkdir -p tests
|
||||
echo "@c auto-generated by configure" > doc/config.texi
|
||||
|
||||
print_config ARCH_ "$config_files" $ARCH_LIST
|
||||
|
||||
+2
-2
@@ -214,10 +214,10 @@ API changes, most recent first:
|
||||
2014-05-11 - 14aef38 / 66e6c8a - lavu 52.83.100 / 53.14.0 - pixfmt.h
|
||||
Add AV_PIX_FMT_VDA for new-style VDA acceleration.
|
||||
|
||||
2014-05-xx - xxxxxxx - lavu 52.82.100 - fifo.h
|
||||
2014-05-xx - xxxxxxx - lavu 52.82.0 - fifo.h
|
||||
Add av_fifo_freep() function.
|
||||
|
||||
2014-05-02 - ba52fb11 - lavu 52.81.100 - opt.h
|
||||
2014-05-02 - ba52fb11 - lavu 52.81.0 - opt.h
|
||||
Add av_opt_set_dict2() function.
|
||||
|
||||
2014-05-01 - e77b985 / a2941c8 - lavc 55.60.103 / 55.50.3 - avcodec.h
|
||||
|
||||
+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.4.6
|
||||
PROJECT_NUMBER =
|
||||
|
||||
# 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
|
||||
|
||||
@@ -29,7 +29,6 @@ OBJS=$(addsuffix .o,$(EXAMPLES))
|
||||
|
||||
# the following examples make explicit use of the math library
|
||||
avcodec: LDLIBS += -lm
|
||||
decoding_encoding: LDLIBS += -lm
|
||||
muxing: LDLIBS += -lm
|
||||
resampling_audio: LDLIBS += -lm
|
||||
|
||||
|
||||
@@ -199,7 +199,8 @@ int main(int argc, char **argv)
|
||||
fmt, dst_ch_layout, dst_nb_channels, dst_rate, dst_filename);
|
||||
|
||||
end:
|
||||
fclose(dst_file);
|
||||
if (dst_file)
|
||||
fclose(dst_file);
|
||||
|
||||
if (src_data)
|
||||
av_freep(&src_data[0]);
|
||||
|
||||
@@ -132,7 +132,8 @@ int main(int argc, char **argv)
|
||||
av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h, dst_filename);
|
||||
|
||||
end:
|
||||
fclose(dst_file);
|
||||
if (dst_file)
|
||||
fclose(dst_file);
|
||||
av_freep(&src_data[0]);
|
||||
av_freep(&dst_data[0]);
|
||||
sws_freeContext(sws_ctx);
|
||||
|
||||
@@ -116,10 +116,6 @@ static int open_output_file(const char *filename)
|
||||
|| dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
/* in this example, we choose transcoding to same codec */
|
||||
encoder = avcodec_find_encoder(dec_ctx->codec_id);
|
||||
if (!encoder) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Neccessary encoder not found\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* In this example, we transcode to same properties (picture size,
|
||||
* sample rate etc.). These properties can be changed for output
|
||||
|
||||
+2
-2
@@ -14,9 +14,9 @@
|
||||
# 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
|
||||
# General Public License for more details.
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# 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
|
||||
|
||||
|
||||
@@ -978,8 +978,10 @@ static void do_video_out(AVFormatContext *s,
|
||||
/* raw pictures are written as AVPicture structure to
|
||||
avoid any copies. We support temporarily the older
|
||||
method. */
|
||||
if (in_picture->interlaced_frame)
|
||||
mux_enc->field_order = in_picture->top_field_first ? AV_FIELD_TB:AV_FIELD_BT;
|
||||
mux_enc->coded_frame->interlaced_frame = in_picture->interlaced_frame;
|
||||
mux_enc->coded_frame->top_field_first = in_picture->top_field_first;
|
||||
if (mux_enc->coded_frame->interlaced_frame)
|
||||
mux_enc->field_order = mux_enc->coded_frame->top_field_first ? AV_FIELD_TB:AV_FIELD_BT;
|
||||
else
|
||||
mux_enc->field_order = AV_FIELD_PROGRESSIVE;
|
||||
pkt.data = (uint8_t *)in_picture;
|
||||
@@ -2461,7 +2463,7 @@ static int transcode_init(void)
|
||||
AVFormatContext *oc;
|
||||
OutputStream *ost;
|
||||
InputStream *ist;
|
||||
char error[1024] = {0};
|
||||
char error[1024];
|
||||
int want_sdp = 1;
|
||||
|
||||
for (i = 0; i < nb_filtergraphs; i++) {
|
||||
|
||||
+1
-1
@@ -702,7 +702,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
||||
MATCH_PER_STREAM_OPT(fix_sub_duration, i, ist->fix_sub_duration, ic, st);
|
||||
MATCH_PER_STREAM_OPT(canvas_sizes, str, canvas_size, ic, st);
|
||||
if (canvas_size &&
|
||||
av_parse_video_size(&ist->dec_ctx->width, &ist->dec_ctx->height, canvas_size) < 0) {
|
||||
av_parse_video_size(&dec->width, &dec->height, canvas_size) < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Invalid canvas size: %s.\n", canvas_size);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
|
||||
energy_cpl = energy[blk][CPL_CH][bnd];
|
||||
energy_ch = energy[blk][ch][bnd];
|
||||
blk1 = blk+1;
|
||||
while (blk1 < s->num_blocks && !s->blocks[blk1].new_cpl_coords[ch]) {
|
||||
while (!s->blocks[blk1].new_cpl_coords[ch] && blk1 < s->num_blocks) {
|
||||
if (s->blocks[blk1].cpl_in_use) {
|
||||
energy_cpl += energy[blk1][CPL_CH][bnd];
|
||||
energy_ch += energy[blk1][ch][bnd];
|
||||
|
||||
@@ -107,10 +107,8 @@ av_cold void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth,
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
#if HAVE_ARMV6
|
||||
if (have_setend(cpu_flags))
|
||||
c->startcode_find_candidate = ff_startcode_find_candidate_armv6;
|
||||
#endif
|
||||
if (have_neon(cpu_flags))
|
||||
h264dsp_init_neon(c, bit_depth, chroma_format_idc);
|
||||
}
|
||||
|
||||
@@ -28,10 +28,8 @@ av_cold void ff_vc1dsp_init_arm(VC1DSPContext *dsp)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
#if HAVE_ARMV6
|
||||
if (have_setend(cpu_flags))
|
||||
dsp->startcode_find_candidate = ff_startcode_find_candidate_armv6;
|
||||
#endif
|
||||
if (have_neon(cpu_flags))
|
||||
ff_vc1dsp_init_neon(dsp);
|
||||
}
|
||||
|
||||
+2
-9
@@ -26,10 +26,8 @@
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/mem.h"
|
||||
|
||||
#include "aandcttab.h"
|
||||
#include "asv.h"
|
||||
#include "avcodec.h"
|
||||
#include "dct.h"
|
||||
#include "fdctdsp.h"
|
||||
#include "internal.h"
|
||||
#include "mathops.h"
|
||||
@@ -333,13 +331,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
((uint32_t *) avctx->extradata)[1] = av_le2ne32(AV_RL32("ASUS"));
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
if (a->fdsp.fdct == ff_fdct_ifast) {
|
||||
int q = 32LL * scale * ff_mpeg1_default_intra_matrix[i] * ff_aanscales[i];
|
||||
a->q_intra_matrix[i] = (((int64_t)a->inv_qscale << 30) + q / 2) / q;
|
||||
} else {
|
||||
int q = 32 * scale * ff_mpeg1_default_intra_matrix[i];
|
||||
a->q_intra_matrix[i] = ((a->inv_qscale << 16) + q / 2) / q;
|
||||
}
|
||||
int q = 32 * scale * ff_mpeg1_default_intra_matrix[i];
|
||||
a->q_intra_matrix[i] = ((a->inv_qscale << 16) + q / 2) / q;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -135,7 +135,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip *strip,
|
||||
const uint8_t *eod = (data + size);
|
||||
uint32_t flag, mask;
|
||||
uint8_t *cb0, *cb1, *cb2, *cb3;
|
||||
int x, y;
|
||||
unsigned int x, y;
|
||||
char *ip0, *ip1, *ip2, *ip3;
|
||||
|
||||
flag = 0;
|
||||
|
||||
+2
-2
@@ -1215,8 +1215,8 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
|
||||
|
||||
q->num_subpackets++;
|
||||
s++;
|
||||
if (s > FFMIN(MAX_SUBPACKETS, avctx->block_align)) {
|
||||
avpriv_request_sample(avctx, "subpackets > %d", FFMIN(MAX_SUBPACKETS, avctx->block_align));
|
||||
if (s > MAX_SUBPACKETS) {
|
||||
avpriv_request_sample(avctx, "subpackets > %d", MAX_SUBPACKETS);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2359,10 +2359,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#else
|
||||
if (s->xch_present && !s->xch_disable) {
|
||||
#endif
|
||||
if (avctx->channel_layout & AV_CH_BACK_CENTER) {
|
||||
avpriv_request_sample(avctx, "XCh with Back center channel");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avctx->channel_layout |= AV_CH_BACK_CENTER;
|
||||
if (s->lfe) {
|
||||
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
|
||||
|
||||
@@ -171,10 +171,6 @@ static inline int dirac_get_arith_uint(DiracArith *c, int follow_ctx, int data_c
|
||||
{
|
||||
int ret = 1;
|
||||
while (!dirac_get_arith_bit(c, follow_ctx)) {
|
||||
if (ret >= 0x40000000) {
|
||||
av_log(NULL, AV_LOG_ERROR, "dirac_get_arith_uint overflow\n");
|
||||
return -1;
|
||||
}
|
||||
ret <<= 1;
|
||||
ret += dirac_get_arith_bit(c, data_ctx);
|
||||
follow_ctx = ff_dirac_next_ctx[follow_ctx];
|
||||
|
||||
@@ -612,10 +612,10 @@ static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b
|
||||
|
||||
top = 0;
|
||||
for (cb_y = 0; cb_y < cb_height; cb_y++) {
|
||||
bottom = (b->height * (cb_y+1LL)) / cb_height;
|
||||
bottom = (b->height * (cb_y+1)) / cb_height;
|
||||
left = 0;
|
||||
for (cb_x = 0; cb_x < cb_width; cb_x++) {
|
||||
right = (b->width * (cb_x+1LL)) / cb_width;
|
||||
right = (b->width * (cb_x+1)) / cb_width;
|
||||
codeblock(s, b, &gb, &c, left, right, top, bottom, blockcnt_one, is_arith);
|
||||
left = right;
|
||||
}
|
||||
@@ -1004,8 +1004,8 @@ static int dirac_unpack_idwt_params(DiracContext *s)
|
||||
/* Codeblock parameters (core syntax only) */
|
||||
if (get_bits1(gb)) {
|
||||
for (i = 0; i <= s->wavelet_depth; i++) {
|
||||
CHECKEDREAD(s->codeblock[i].width , tmp < 1 || tmp > (s->avctx->width >>s->wavelet_depth-i), "codeblock width invalid\n")
|
||||
CHECKEDREAD(s->codeblock[i].height, tmp < 1 || tmp > (s->avctx->height>>s->wavelet_depth-i), "codeblock height invalid\n")
|
||||
CHECKEDREAD(s->codeblock[i].width , tmp < 1, "codeblock width invalid\n")
|
||||
CHECKEDREAD(s->codeblock[i].height, tmp < 1, "codeblock height invalid\n")
|
||||
}
|
||||
|
||||
CHECKEDREAD(s->codeblock_mode, tmp > 1, "unknown codeblock mode\n")
|
||||
|
||||
+3
-10
@@ -38,7 +38,6 @@ typedef struct DNXHDContext {
|
||||
BlockDSPContext bdsp;
|
||||
int64_t cid; ///< compression id
|
||||
unsigned int width, height;
|
||||
enum AVPixelFormat pix_fmt;
|
||||
unsigned int mb_width, mb_height;
|
||||
uint32_t mb_scan_index[68]; /* max for 1080p */
|
||||
int cur_field; ///< current interlaced field
|
||||
@@ -142,7 +141,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
|
||||
|
||||
ctx->is_444 = 0;
|
||||
if (buf[0x4] == 0x2) {
|
||||
ctx->pix_fmt = AV_PIX_FMT_YUV444P10;
|
||||
ctx->avctx->pix_fmt = AV_PIX_FMT_YUV444P10;
|
||||
ctx->avctx->bits_per_raw_sample = 10;
|
||||
if (ctx->bit_depth != 10) {
|
||||
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
|
||||
@@ -152,7 +151,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
|
||||
}
|
||||
ctx->is_444 = 1;
|
||||
} else if (buf[0x21] & 0x40) {
|
||||
ctx->pix_fmt = AV_PIX_FMT_YUV422P10;
|
||||
ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
|
||||
ctx->avctx->bits_per_raw_sample = 10;
|
||||
if (ctx->bit_depth != 10) {
|
||||
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
|
||||
@@ -161,7 +160,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
|
||||
ctx->decode_dct_block = dnxhd_decode_dct_block_10;
|
||||
}
|
||||
} else {
|
||||
ctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
||||
ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
||||
ctx->avctx->bits_per_raw_sample = 8;
|
||||
if (ctx->bit_depth != 8) {
|
||||
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
|
||||
@@ -447,13 +446,7 @@ decode_coding_unit:
|
||||
avctx->width, avctx->height, ctx->width, ctx->height);
|
||||
first_field = 1;
|
||||
}
|
||||
if (avctx->pix_fmt != AV_PIX_FMT_NONE && avctx->pix_fmt != ctx->pix_fmt) {
|
||||
av_log(avctx, AV_LOG_WARNING, "pix_fmt changed: %s -> %s\n",
|
||||
av_get_pix_fmt_name(avctx->pix_fmt), av_get_pix_fmt_name(ctx->pix_fmt));
|
||||
first_field = 1;
|
||||
}
|
||||
|
||||
avctx->pix_fmt = ctx->pix_fmt;
|
||||
ret = ff_set_dimensions(avctx, ctx->width, ctx->height);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+13
-15
@@ -37,7 +37,7 @@ typedef struct DVDSubContext
|
||||
int has_palette;
|
||||
uint8_t colormap[4];
|
||||
uint8_t alpha[256];
|
||||
uint8_t buf[0x10000];
|
||||
uint8_t *buf;
|
||||
int buf_size;
|
||||
#ifdef DEBUG
|
||||
int sub_id;
|
||||
@@ -105,12 +105,6 @@ static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
|
||||
int x, y, len, color;
|
||||
uint8_t *d;
|
||||
|
||||
if (start >= buf_size)
|
||||
return -1;
|
||||
|
||||
if (w <= 0 || h <= 0)
|
||||
return -1;
|
||||
|
||||
bit_len = (buf_size - start) * 8;
|
||||
init_get_bits(&gb, buf + start, bit_len);
|
||||
|
||||
@@ -362,12 +356,10 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
|
||||
sub_header->rects[0] = av_mallocz(sizeof(AVSubtitleRect));
|
||||
sub_header->num_rects = 1;
|
||||
sub_header->rects[0]->pict.data[0] = bitmap;
|
||||
if (decode_rle(bitmap, w * 2, w, (h + 1) / 2,
|
||||
buf, offset1, buf_size, is_8bit) < 0)
|
||||
goto fail;
|
||||
if (decode_rle(bitmap + w, w * 2, w, h / 2,
|
||||
buf, offset2, buf_size, is_8bit) < 0)
|
||||
goto fail;
|
||||
decode_rle(bitmap, w * 2, w, (h + 1) / 2,
|
||||
buf, offset1, buf_size, is_8bit);
|
||||
decode_rle(bitmap + w, w * 2, w, h / 2,
|
||||
buf, offset2, buf_size, is_8bit);
|
||||
sub_header->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
|
||||
if (is_8bit) {
|
||||
if (!yuv_palette)
|
||||
@@ -506,11 +498,15 @@ static int append_to_cached_buf(AVCodecContext *avctx,
|
||||
{
|
||||
DVDSubContext *ctx = avctx->priv_data;
|
||||
|
||||
if (ctx->buf_size >= sizeof(ctx->buf) - buf_size) {
|
||||
if (ctx->buf_size > 0xffff - buf_size) {
|
||||
av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct "
|
||||
"too large SPU packets aborted.\n");
|
||||
av_freep(&ctx->buf);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
ctx->buf = av_realloc(ctx->buf, ctx->buf_size + buf_size);
|
||||
if (!ctx->buf)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(ctx->buf + ctx->buf_size, buf, buf_size);
|
||||
ctx->buf_size += buf_size;
|
||||
return 0;
|
||||
@@ -526,7 +522,7 @@ static int dvdsub_decode(AVCodecContext *avctx,
|
||||
AVSubtitle *sub = data;
|
||||
int is_menu;
|
||||
|
||||
if (ctx->buf_size) {
|
||||
if (ctx->buf) {
|
||||
int ret = append_to_cached_buf(avctx, buf, buf_size);
|
||||
if (ret < 0) {
|
||||
*data_size = 0;
|
||||
@@ -565,6 +561,7 @@ static int dvdsub_decode(AVCodecContext *avctx,
|
||||
}
|
||||
#endif
|
||||
|
||||
av_freep(&ctx->buf);
|
||||
ctx->buf_size = 0;
|
||||
*data_size = 1;
|
||||
return buf_size;
|
||||
@@ -646,6 +643,7 @@ static av_cold int dvdsub_init(AVCodecContext *avctx)
|
||||
static av_cold int dvdsub_close(AVCodecContext *avctx)
|
||||
{
|
||||
DVDSubContext *ctx = avctx->priv_data;
|
||||
av_freep(&ctx->buf);
|
||||
ctx->buf_size = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -329,11 +329,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
DxaDecContext * const c = avctx->priv_data;
|
||||
|
||||
if (avctx->width%4 || avctx->height%4) {
|
||||
avpriv_request_sample(avctx, "dimensions are not a multiple of 4");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
c->prev = av_frame_alloc();
|
||||
if (!c->prev)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -473,10 +473,10 @@ static int decode_frame(FLACContext *s)
|
||||
ret = allocate_buffers(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->bps);
|
||||
s->got_streaminfo = 1;
|
||||
dump_headers(s->avctx, (FLACStreaminfo *)s);
|
||||
}
|
||||
ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->bps);
|
||||
|
||||
// dump_headers(s->avctx, (FLACStreaminfo *)s);
|
||||
|
||||
|
||||
+2
-4
@@ -736,10 +736,8 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
c->tile_width = bytestream2_get_be32(&bc);
|
||||
c->tile_height = bytestream2_get_be32(&bc);
|
||||
if (c->tile_width <= 0 || c->tile_height <= 0 ||
|
||||
((c->tile_width | c->tile_height) & 0xF) ||
|
||||
c->tile_width * 4LL * c->tile_height >= INT_MAX
|
||||
) {
|
||||
if (!c->tile_width || !c->tile_height ||
|
||||
((c->tile_width | c->tile_height) & 0xF)) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid tile dimensions %dx%d\n",
|
||||
c->tile_width, c->tile_height);
|
||||
|
||||
+10
-5
@@ -271,21 +271,26 @@ static int gif_read_image(GifState *s, AVFrame *frame)
|
||||
case 1:
|
||||
y1 += 8;
|
||||
ptr += linesize * 8;
|
||||
if (y1 >= height) {
|
||||
y1 = pass ? 2 : 4;
|
||||
ptr = ptr1 + linesize * y1;
|
||||
pass++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
y1 += 4;
|
||||
ptr += linesize * 4;
|
||||
if (y1 >= height) {
|
||||
y1 = 1;
|
||||
ptr = ptr1 + linesize;
|
||||
pass++;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
y1 += 2;
|
||||
ptr += linesize * 2;
|
||||
break;
|
||||
}
|
||||
while (y1 >= height) {
|
||||
y1 = 4 >> pass;
|
||||
ptr = ptr1 + linesize * y1;
|
||||
pass++;
|
||||
}
|
||||
} else {
|
||||
ptr += linesize;
|
||||
}
|
||||
|
||||
@@ -336,14 +336,6 @@ static int decode_slice(MpegEncContext *s)
|
||||
s->padding_bug_score += 32;
|
||||
}
|
||||
|
||||
if (s->codec_id == AV_CODEC_ID_H263 &&
|
||||
(s->workaround_bugs & FF_BUG_AUTODETECT) &&
|
||||
get_bits_left(&s->gb) >= 64 &&
|
||||
AV_RB64(s->gb.buffer_end - 8) == 0xCDCDCDCDFC7F0000) {
|
||||
|
||||
s->padding_bug_score += 32;
|
||||
}
|
||||
|
||||
if (s->workaround_bugs & FF_BUG_AUTODETECT) {
|
||||
if (s->padding_bug_score > -2 && !s->data_partitioning)
|
||||
s->workaround_bugs |= FF_BUG_NO_PADDING;
|
||||
|
||||
+43
-17
@@ -215,18 +215,18 @@ int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma)
|
||||
|
||||
if ((h->left_samples_available & 0x8080) != 0x8080) {
|
||||
mode = left[mode];
|
||||
if (mode < 0) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"left block unavailable for requested intra mode at %d %d\n",
|
||||
h->mb_x, h->mb_y);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (is_chroma && (h->left_samples_available & 0x8080)) {
|
||||
// mad cow disease mode, aka MBAFF + constrained_intra_pred
|
||||
mode = ALZHEIMER_DC_L0T_PRED8x8 +
|
||||
(!(h->left_samples_available & 0x8000)) +
|
||||
2 * (mode == DC_128_PRED8x8);
|
||||
}
|
||||
if (mode < 0) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"left block unavailable for requested intra mode at %d %d\n",
|
||||
h->mb_x, h->mb_y);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
return mode;
|
||||
@@ -391,7 +391,6 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp)
|
||||
if (free_rbsp && h->DPB) {
|
||||
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)
|
||||
ff_h264_unref_picture(h, &h->DPB[i]);
|
||||
memset(h->delayed_pic, 0, sizeof(h->delayed_pic));
|
||||
av_freep(&h->DPB);
|
||||
} else if (h->DPB) {
|
||||
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)
|
||||
@@ -991,16 +990,6 @@ int ff_pred_weight_table(H264Context *h)
|
||||
h->luma_log2_weight_denom = get_ue_golomb(&h->gb);
|
||||
if (h->sps.chroma_format_idc)
|
||||
h->chroma_log2_weight_denom = get_ue_golomb(&h->gb);
|
||||
|
||||
if (h->luma_log2_weight_denom > 7U) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "luma_log2_weight_denom %d is out of range\n", h->luma_log2_weight_denom);
|
||||
h->luma_log2_weight_denom = 0;
|
||||
}
|
||||
if (h->chroma_log2_weight_denom > 7U) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "chroma_log2_weight_denom %d is out of range\n", h->chroma_log2_weight_denom);
|
||||
h->chroma_log2_weight_denom = 0;
|
||||
}
|
||||
|
||||
luma_def = 1 << h->luma_log2_weight_denom;
|
||||
chroma_def = 1 << h->chroma_log2_weight_denom;
|
||||
|
||||
@@ -1341,6 +1330,43 @@ int ff_set_ref_count(H264Context *h)
|
||||
|
||||
static const uint8_t start_code[] = { 0x00, 0x00, 0x01 };
|
||||
|
||||
static int find_start_code(const uint8_t *buf, int buf_size,
|
||||
int buf_index, int next_avc)
|
||||
{
|
||||
// start code prefix search
|
||||
for (; buf_index + 3 < next_avc; buf_index++)
|
||||
// This should always succeed in the first iteration.
|
||||
if (buf[buf_index] == 0 &&
|
||||
buf[buf_index + 1] == 0 &&
|
||||
buf[buf_index + 2] == 1)
|
||||
break;
|
||||
|
||||
buf_index += 3;
|
||||
|
||||
if (buf_index >= buf_size)
|
||||
return buf_size;
|
||||
|
||||
return buf_index;
|
||||
}
|
||||
|
||||
static int get_avc_nalsize(H264Context *h, const uint8_t *buf,
|
||||
int buf_size, int *buf_index)
|
||||
{
|
||||
int i, nalsize = 0;
|
||||
|
||||
if (*buf_index >= buf_size - h->nal_length_size)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < h->nal_length_size; i++)
|
||||
nalsize = (nalsize << 8) | buf[(*buf_index)++];
|
||||
if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"AVC: nal size %d\n", nalsize);
|
||||
return -1;
|
||||
}
|
||||
return nalsize;
|
||||
}
|
||||
|
||||
static int get_bit_length(H264Context *h, const uint8_t *buf,
|
||||
const uint8_t *ptr, int dst_length,
|
||||
int i, int next_avc)
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "h264dsp.h"
|
||||
#include "h264pred.h"
|
||||
#include "h264qpel.h"
|
||||
#include "internal.h" // for avpriv_find_start_code()
|
||||
#include "me_cmp.h"
|
||||
#include "mpegutils.h"
|
||||
#include "parser.h"
|
||||
@@ -338,7 +337,6 @@ typedef struct H264Picture {
|
||||
* H264Context
|
||||
*/
|
||||
typedef struct H264Context {
|
||||
AVClass *av_class;
|
||||
AVCodecContext *avctx;
|
||||
MECmpContext mecc;
|
||||
VideoDSPContext vdsp;
|
||||
@@ -1094,34 +1092,6 @@ static av_always_inline int get_dct8x8_allowed(H264Context *h)
|
||||
0x0001000100010001ULL));
|
||||
}
|
||||
|
||||
static inline int find_start_code(const uint8_t *buf, int buf_size,
|
||||
int buf_index, int next_avc)
|
||||
{
|
||||
uint32_t state = -1;
|
||||
|
||||
buf_index = avpriv_find_start_code(buf + buf_index, buf + next_avc + 1, &state) - buf - 1;
|
||||
|
||||
return FFMIN(buf_index, buf_size);
|
||||
}
|
||||
|
||||
static inline int get_avc_nalsize(H264Context *h, const uint8_t *buf,
|
||||
int buf_size, int *buf_index)
|
||||
{
|
||||
int i, nalsize = 0;
|
||||
|
||||
if (*buf_index >= buf_size - h->nal_length_size)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < h->nal_length_size; i++)
|
||||
nalsize = ((unsigned)nalsize << 8) | buf[(*buf_index)++];
|
||||
if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"AVC: nal size %d\n", nalsize);
|
||||
return -1;
|
||||
}
|
||||
return nalsize;
|
||||
}
|
||||
|
||||
int ff_h264_field_end(H264Context *h, int in_setup);
|
||||
|
||||
int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src);
|
||||
|
||||
+19
-21
@@ -202,10 +202,10 @@ static int scan_mmco_reset(AVCodecParserContext *s)
|
||||
*/
|
||||
static inline int parse_nal_units(AVCodecParserContext *s,
|
||||
AVCodecContext *avctx,
|
||||
const uint8_t * const buf, int buf_size)
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
H264Context *h = s->priv_data;
|
||||
int buf_index, next_avc;
|
||||
const uint8_t *buf_end = buf + buf_size;
|
||||
unsigned int pps_id;
|
||||
unsigned int slice_type;
|
||||
int state = -1, got_reset = 0;
|
||||
@@ -225,26 +225,26 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
||||
if (!buf_size)
|
||||
return 0;
|
||||
|
||||
buf_index = 0;
|
||||
next_avc = h->is_avc ? 0 : buf_size;
|
||||
for (;;) {
|
||||
int src_length, dst_length, consumed, nalsize = 0;
|
||||
|
||||
if (buf_index >= next_avc) {
|
||||
nalsize = get_avc_nalsize(h, buf, buf_size, &buf_index);
|
||||
if (nalsize < 0)
|
||||
if (h->is_avc) {
|
||||
int i;
|
||||
if (h->nal_length_size >= buf_end - buf) break;
|
||||
nalsize = 0;
|
||||
for (i = 0; i < h->nal_length_size; i++)
|
||||
nalsize = (nalsize << 8) | *buf++;
|
||||
if (nalsize <= 0 || nalsize > buf_end - buf) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "AVC: nal size %d\n", nalsize);
|
||||
break;
|
||||
next_avc = buf_index + nalsize;
|
||||
}
|
||||
src_length = nalsize;
|
||||
} else {
|
||||
buf_index = find_start_code(buf, buf_size, buf_index, next_avc);
|
||||
if (buf_index >= buf_size)
|
||||
break;
|
||||
if (buf_index >= next_avc)
|
||||
continue;
|
||||
buf = avpriv_find_start_code(buf, buf_end, &state);
|
||||
if (buf >= buf_end)
|
||||
break;
|
||||
--buf;
|
||||
src_length = buf_end - buf;
|
||||
}
|
||||
src_length = next_avc - buf_index;
|
||||
|
||||
state = buf[buf_index];
|
||||
switch (state & 0x1f) {
|
||||
case NAL_SLICE:
|
||||
case NAL_IDR_SLICE:
|
||||
@@ -261,13 +261,10 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
||||
}
|
||||
break;
|
||||
}
|
||||
ptr = ff_h264_decode_nal(h, buf + buf_index, &dst_length,
|
||||
&consumed, src_length);
|
||||
ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
|
||||
if (!ptr || dst_length < 0)
|
||||
break;
|
||||
|
||||
buf_index += consumed;
|
||||
|
||||
init_get_bits(&h->gb, ptr, 8 * dst_length);
|
||||
switch (h->nal_unit_type) {
|
||||
case NAL_SPS:
|
||||
@@ -442,6 +439,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
||||
|
||||
return 0; /* no need to evaluate the rest */
|
||||
}
|
||||
buf += h->is_avc ? nalsize : consumed;
|
||||
}
|
||||
if (q264)
|
||||
return 0;
|
||||
|
||||
@@ -281,7 +281,7 @@ static int decode_display_orientation(H264Context *h)
|
||||
|
||||
int ff_h264_decode_sei(H264Context *h)
|
||||
{
|
||||
while (get_bits_left(&h->gb) > 16 && show_bits(&h->gb, 16)) {
|
||||
while (get_bits_left(&h->gb) > 16) {
|
||||
int type = 0;
|
||||
unsigned size = 0;
|
||||
unsigned next;
|
||||
|
||||
+36
-55
@@ -585,17 +585,6 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
|
||||
h->mb_type_pool = NULL;
|
||||
h->ref_index_pool = NULL;
|
||||
h->motion_val_pool = NULL;
|
||||
h->intra4x4_pred_mode= NULL;
|
||||
h->non_zero_count = NULL;
|
||||
h->slice_table_base = NULL;
|
||||
h->slice_table = NULL;
|
||||
h->cbp_table = NULL;
|
||||
h->chroma_pred_mode_table = NULL;
|
||||
memset(h->mvd_table, 0, sizeof(h->mvd_table));
|
||||
h->direct_table = NULL;
|
||||
h->list_counts = NULL;
|
||||
h->mb2b_xy = NULL;
|
||||
h->mb2br_xy = NULL;
|
||||
for (i = 0; i < 2; i++) {
|
||||
h->rbsp_buffer[i] = NULL;
|
||||
h->rbsp_buffer_size[i] = 0;
|
||||
@@ -1036,79 +1025,76 @@ static int clone_slice(H264Context *dst, H264Context *src)
|
||||
|
||||
static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
|
||||
{
|
||||
enum AVPixelFormat pix_fmts[2];
|
||||
const enum AVPixelFormat *choices = pix_fmts;
|
||||
int i;
|
||||
|
||||
pix_fmts[1] = AV_PIX_FMT_NONE;
|
||||
|
||||
switch (h->sps.bit_depth_luma) {
|
||||
case 9:
|
||||
if (CHROMA444(h)) {
|
||||
if (h->avctx->colorspace == AVCOL_SPC_RGB) {
|
||||
pix_fmts[0] = AV_PIX_FMT_GBRP9;
|
||||
return AV_PIX_FMT_GBRP9;
|
||||
} else
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV444P9;
|
||||
return AV_PIX_FMT_YUV444P9;
|
||||
} else if (CHROMA422(h))
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV422P9;
|
||||
return AV_PIX_FMT_YUV422P9;
|
||||
else
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV420P9;
|
||||
return AV_PIX_FMT_YUV420P9;
|
||||
break;
|
||||
case 10:
|
||||
if (CHROMA444(h)) {
|
||||
if (h->avctx->colorspace == AVCOL_SPC_RGB) {
|
||||
pix_fmts[0] = AV_PIX_FMT_GBRP10;
|
||||
return AV_PIX_FMT_GBRP10;
|
||||
} else
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV444P10;
|
||||
return AV_PIX_FMT_YUV444P10;
|
||||
} else if (CHROMA422(h))
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV422P10;
|
||||
return AV_PIX_FMT_YUV422P10;
|
||||
else
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV420P10;
|
||||
return AV_PIX_FMT_YUV420P10;
|
||||
break;
|
||||
case 12:
|
||||
if (CHROMA444(h)) {
|
||||
if (h->avctx->colorspace == AVCOL_SPC_RGB) {
|
||||
pix_fmts[0] = AV_PIX_FMT_GBRP12;
|
||||
return AV_PIX_FMT_GBRP12;
|
||||
} else
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV444P12;
|
||||
return AV_PIX_FMT_YUV444P12;
|
||||
} else if (CHROMA422(h))
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV422P12;
|
||||
return AV_PIX_FMT_YUV422P12;
|
||||
else
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV420P12;
|
||||
return AV_PIX_FMT_YUV420P12;
|
||||
break;
|
||||
case 14:
|
||||
if (CHROMA444(h)) {
|
||||
if (h->avctx->colorspace == AVCOL_SPC_RGB) {
|
||||
pix_fmts[0] = AV_PIX_FMT_GBRP14;
|
||||
return AV_PIX_FMT_GBRP14;
|
||||
} else
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV444P14;
|
||||
return AV_PIX_FMT_YUV444P14;
|
||||
} else if (CHROMA422(h))
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV422P14;
|
||||
return AV_PIX_FMT_YUV422P14;
|
||||
else
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV420P14;
|
||||
return AV_PIX_FMT_YUV420P14;
|
||||
break;
|
||||
case 8:
|
||||
if (CHROMA444(h)) {
|
||||
if (h->avctx->colorspace == AVCOL_SPC_YCGCO)
|
||||
if (h->avctx->colorspace == AVCOL_SPC_RGB) {
|
||||
av_log(h->avctx, AV_LOG_DEBUG, "Detected GBR colorspace.\n");
|
||||
return AV_PIX_FMT_GBR24P;
|
||||
} else if (h->avctx->colorspace == AVCOL_SPC_YCGCO) {
|
||||
av_log(h->avctx, AV_LOG_WARNING, "Detected unsupported YCgCo colorspace.\n");
|
||||
if (h->avctx->colorspace == AVCOL_SPC_RGB)
|
||||
pix_fmts[0] = AV_PIX_FMT_GBRP;
|
||||
else if (h->avctx->color_range == AVCOL_RANGE_JPEG)
|
||||
pix_fmts[0] = AV_PIX_FMT_YUVJ444P;
|
||||
else
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV444P;
|
||||
}
|
||||
return h->avctx->color_range == AVCOL_RANGE_JPEG ? AV_PIX_FMT_YUVJ444P
|
||||
: AV_PIX_FMT_YUV444P;
|
||||
} else if (CHROMA422(h)) {
|
||||
if (h->avctx->color_range == AVCOL_RANGE_JPEG)
|
||||
pix_fmts[0] = AV_PIX_FMT_YUVJ422P;
|
||||
else
|
||||
pix_fmts[0] = AV_PIX_FMT_YUV422P;
|
||||
return h->avctx->color_range == AVCOL_RANGE_JPEG ? AV_PIX_FMT_YUVJ422P
|
||||
: AV_PIX_FMT_YUV422P;
|
||||
} else {
|
||||
if (h->avctx->codec->pix_fmts)
|
||||
choices = h->avctx->codec->pix_fmts;
|
||||
else if (h->avctx->color_range == AVCOL_RANGE_JPEG)
|
||||
choices = h264_hwaccel_pixfmt_list_jpeg_420;
|
||||
else
|
||||
choices = h264_hwaccel_pixfmt_list_420;
|
||||
int i;
|
||||
const enum AVPixelFormat * fmt = h->avctx->codec->pix_fmts ?
|
||||
h->avctx->codec->pix_fmts :
|
||||
h->avctx->color_range == AVCOL_RANGE_JPEG ?
|
||||
h264_hwaccel_pixfmt_list_jpeg_420 :
|
||||
h264_hwaccel_pixfmt_list_420;
|
||||
|
||||
for (i=0; fmt[i] != AV_PIX_FMT_NONE; i++)
|
||||
if (fmt[i] == h->avctx->pix_fmt && !force_callback)
|
||||
return fmt[i];
|
||||
return ff_thread_get_format(h->avctx, fmt);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1116,11 +1102,6 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
|
||||
"Unsupported bit depth %d\n", h->sps.bit_depth_luma);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (i=0; choices[i] != AV_PIX_FMT_NONE; i++)
|
||||
if (choices[i] == h->avctx->pix_fmt && !force_callback)
|
||||
return choices[i];
|
||||
return ff_thread_get_format(h->avctx, choices);
|
||||
}
|
||||
|
||||
/* export coded and cropped frame dimensions to AVCodecContext */
|
||||
|
||||
+3
-3
@@ -108,7 +108,7 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps)
|
||||
if (!s->tab_ipm || !s->cbf_luma || !s->is_pcm)
|
||||
goto fail;
|
||||
|
||||
s->filter_slice_edges = av_mallocz(ctb_count);
|
||||
s->filter_slice_edges = av_malloc(ctb_count);
|
||||
s->tab_slice_address = av_malloc_array(pic_size_in_ctb,
|
||||
sizeof(*s->tab_slice_address));
|
||||
s->qp_y_tab = av_malloc_array(pic_size_in_ctb,
|
||||
@@ -981,7 +981,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0,
|
||||
for (i = 0; i < (size * size); i++) {
|
||||
coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3);
|
||||
}
|
||||
s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride);
|
||||
s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1010,7 +1010,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0,
|
||||
for (i = 0; i < (size * size); i++) {
|
||||
coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3);
|
||||
}
|
||||
s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride);
|
||||
s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride);
|
||||
}
|
||||
}
|
||||
} else if (blk_idx == 3) {
|
||||
|
||||
@@ -227,10 +227,8 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0,
|
||||
|
||||
HEVCFrame *ref = s->ref->collocated_ref;
|
||||
|
||||
if (!ref) {
|
||||
memset(mvLXCol, 0, sizeof(*mvLXCol));
|
||||
if (!ref)
|
||||
return 0;
|
||||
}
|
||||
|
||||
tab_mvf = ref->tab_mvf;
|
||||
colPic = ref->poc;
|
||||
@@ -417,10 +415,14 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0,
|
||||
|
||||
if (available_l0 || available_l1) {
|
||||
mergecandlist[nb_merge_cand].pred_flag = available_l0 + (available_l1 << 1);
|
||||
AV_ZERO16(mergecandlist[nb_merge_cand].ref_idx);
|
||||
mergecandlist[nb_merge_cand].mv[0] = mv_l0_col;
|
||||
mergecandlist[nb_merge_cand].mv[1] = mv_l1_col;
|
||||
|
||||
if (available_l0) {
|
||||
mergecandlist[nb_merge_cand].mv[0] = mv_l0_col;
|
||||
mergecandlist[nb_merge_cand].ref_idx[0] = 0;
|
||||
}
|
||||
if (available_l1) {
|
||||
mergecandlist[nb_merge_cand].mv[1] = mv_l1_col;
|
||||
mergecandlist[nb_merge_cand].ref_idx[1] = 0;
|
||||
}
|
||||
if (merge_idx == nb_merge_cand)
|
||||
return;
|
||||
nb_merge_cand++;
|
||||
|
||||
+2
-20
@@ -525,11 +525,7 @@ static void decode_vui(HEVCContext *s, HEVCSPS *sps)
|
||||
vui->field_seq_flag = get_bits1(gb);
|
||||
vui->frame_field_info_present_flag = get_bits1(gb);
|
||||
|
||||
if (get_bits_left(gb) >= 68 && show_bits_long(gb, 21) == 0x100000) {
|
||||
vui->default_display_window_flag = 0;
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Invalid default display window\n");
|
||||
} else
|
||||
vui->default_display_window_flag = get_bits1(gb);
|
||||
vui->default_display_window_flag = get_bits1(gb);
|
||||
// Backup context in case an alternate header is detected
|
||||
memcpy(&backup, gb, sizeof(backup));
|
||||
|
||||
@@ -951,11 +947,6 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
|
||||
sps->long_term_ref_pics_present_flag = get_bits1(gb);
|
||||
if (sps->long_term_ref_pics_present_flag) {
|
||||
sps->num_long_term_ref_pics_sps = get_ue_golomb_long(gb);
|
||||
if (sps->num_long_term_ref_pics_sps > 31U) {
|
||||
av_log(0, AV_LOG_ERROR, "num_long_term_ref_pics_sps %d is out of range.\n",
|
||||
sps->num_long_term_ref_pics_sps);
|
||||
goto err;
|
||||
}
|
||||
for (i = 0; i < sps->num_long_term_ref_pics_sps; i++) {
|
||||
sps->lt_ref_pic_poc_lsb_sps[i] = get_bits(gb, sps->log2_max_poc_lsb);
|
||||
sps->used_by_curr_pic_lt_sps_flag[i] = get_bits1(gb);
|
||||
@@ -1257,14 +1248,6 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
if (pps->cu_qp_delta_enabled_flag)
|
||||
pps->diff_cu_qp_delta_depth = get_ue_golomb_long(gb);
|
||||
|
||||
if (pps->diff_cu_qp_delta_depth < 0 ||
|
||||
pps->diff_cu_qp_delta_depth > sps->log2_diff_max_min_coding_block_size) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "diff_cu_qp_delta_depth %d is invalid\n",
|
||||
pps->diff_cu_qp_delta_depth);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
|
||||
pps->cb_qp_offset = get_se_golomb(gb);
|
||||
if (pps->cb_qp_offset < -12 || pps->cb_qp_offset > 12) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "pps_cb_qp_offset out of range: %d\n",
|
||||
@@ -1388,8 +1371,7 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
int pps_range_extensions_flag = get_bits1(gb);
|
||||
/* int pps_extension_7bits = */ get_bits(gb, 7);
|
||||
if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT && pps_range_extensions_flag) {
|
||||
if ((ret = pps_range_extensions(s, pps, sps)) < 0)
|
||||
goto err;
|
||||
pps_range_extensions(s, pps, sps);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -887,14 +887,14 @@ static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch)
|
||||
|
||||
flag = get_bits1(&q->gb);
|
||||
if (stream_format_code & 0x1)
|
||||
imc_decode_level_coefficients_raw(q, chctx->levlCoeffBuf,
|
||||
chctx->flcoeffs1, chctx->flcoeffs2);
|
||||
else if (stream_format_code & 0x1)
|
||||
imc_read_level_coeffs_raw(q, stream_format_code, chctx->levlCoeffBuf);
|
||||
else
|
||||
imc_read_level_coeffs(q, stream_format_code, chctx->levlCoeffBuf);
|
||||
|
||||
if (stream_format_code & 0x1)
|
||||
imc_decode_level_coefficients_raw(q, chctx->levlCoeffBuf,
|
||||
chctx->flcoeffs1, chctx->flcoeffs2);
|
||||
else if (stream_format_code & 0x4)
|
||||
if (stream_format_code & 0x4)
|
||||
imc_decode_level_coefficients(q, chctx->levlCoeffBuf,
|
||||
chctx->flcoeffs1, chctx->flcoeffs2);
|
||||
else
|
||||
|
||||
+3
-5
@@ -94,7 +94,7 @@ typedef struct Indeo3DecodeContext {
|
||||
|
||||
int16_t width, height;
|
||||
uint32_t frame_num; ///< current frame number (zero-based)
|
||||
int data_size; ///< size of the frame data in bytes
|
||||
uint32_t data_size; ///< size of the frame data in bytes
|
||||
uint16_t frame_flags; ///< frame properties
|
||||
uint8_t cb_offset; ///< needed for selecting VQ tables
|
||||
uint8_t buf_sel; ///< active frame buffer: 0 - primary, 1 -secondary
|
||||
@@ -899,8 +899,7 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
GetByteContext gb;
|
||||
const uint8_t *bs_hdr;
|
||||
uint32_t frame_num, word2, check_sum, data_size;
|
||||
int y_offset, u_offset, v_offset;
|
||||
uint32_t starts[3], ends[3];
|
||||
uint32_t y_offset, u_offset, v_offset, starts[3], ends[3];
|
||||
uint16_t height, width;
|
||||
int i, j;
|
||||
|
||||
@@ -982,8 +981,7 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
ctx->y_data_size = ends[0] - starts[0];
|
||||
ctx->v_data_size = ends[1] - starts[1];
|
||||
ctx->u_data_size = ends[2] - starts[2];
|
||||
if (FFMIN3(y_offset, v_offset, u_offset) < 0 ||
|
||||
FFMAX3(y_offset, v_offset, u_offset) >= ctx->data_size - 16 ||
|
||||
if (FFMAX3(y_offset, v_offset, u_offset) >= ctx->data_size - 16 ||
|
||||
FFMIN3(y_offset, v_offset, u_offset) < gb.buffer - bs_hdr + 16 ||
|
||||
FFMIN3(ctx->y_data_size, ctx->v_data_size, ctx->u_data_size) <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "One of the y/u/v offsets is invalid\n");
|
||||
|
||||
@@ -269,11 +269,6 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s,
|
||||
x += stride;
|
||||
}
|
||||
|
||||
if (x >= w) {
|
||||
av_log(NULL, AV_LOG_ERROR, "run overflow\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* decode run termination value */
|
||||
Rb = R(last, x);
|
||||
RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0;
|
||||
|
||||
@@ -43,13 +43,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
JvContext *s = avctx->priv_data;
|
||||
|
||||
if (!avctx->width || !avctx->height ||
|
||||
(avctx->width & 7) || (avctx->height & 7)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid video dimensions: %dx%d\n",
|
||||
avctx->width, avctx->height);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
s->frame = av_frame_alloc();
|
||||
if (!s->frame)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -96,7 +96,8 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
WebRtcIlbcfix_DecodeImpl((int16_t *) frame->data[0], (const uint16_t *) buf, &s->decoder, 1);
|
||||
WebRtcIlbcfix_DecodeImpl((WebRtc_Word16*) frame->data[0],
|
||||
(const WebRtc_UWord16*) buf, &s->decoder, 1);
|
||||
|
||||
*got_frame_ptr = 1;
|
||||
|
||||
@@ -169,7 +170,7 @@ static int ilbc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, 50)) < 0)
|
||||
return ret;
|
||||
|
||||
WebRtcIlbcfix_EncodeImpl((uint16_t *) avpkt->data, (const int16_t *) frame->data[0], &s->encoder);
|
||||
WebRtcIlbcfix_EncodeImpl((WebRtc_UWord16*) avpkt->data, (const WebRtc_Word16*) frame->data[0], &s->encoder);
|
||||
|
||||
avpkt->size = s->encoder.no_of_bytes;
|
||||
*got_packet_ptr = 1;
|
||||
|
||||
+17
-31
@@ -244,10 +244,9 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
|
||||
|
||||
int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
{
|
||||
int len, nb_components, i, width, height, bits, ret;
|
||||
unsigned pix_fmt_id;
|
||||
int h_count[MAX_COMPONENTS] = { 0 };
|
||||
int v_count[MAX_COMPONENTS] = { 0 };
|
||||
int len, nb_components, i, width, height, pix_fmt_id, ret;
|
||||
int h_count[MAX_COMPONENTS];
|
||||
int v_count[MAX_COMPONENTS];
|
||||
|
||||
s->cur_scan = 0;
|
||||
s->upscale_h = s->upscale_v = 0;
|
||||
@@ -255,11 +254,11 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
/* XXX: verify len field validity */
|
||||
len = get_bits(&s->gb, 16);
|
||||
s->avctx->bits_per_raw_sample =
|
||||
bits = get_bits(&s->gb, 8);
|
||||
s->bits = get_bits(&s->gb, 8);
|
||||
|
||||
if (s->pegasus_rct)
|
||||
bits = 9;
|
||||
if (bits == 9 && !s->pegasus_rct)
|
||||
s->bits = 9;
|
||||
if (s->bits == 9 && !s->pegasus_rct)
|
||||
s->rct = 1; // FIXME ugly
|
||||
|
||||
if(s->lossless && s->avctx->lowres){
|
||||
@@ -292,7 +291,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
if (s->ls && !(bits <= 8 || nb_components == 1)) {
|
||||
if (s->ls && !(s->bits <= 8 || nb_components == 1)) {
|
||||
avpriv_report_missing_feature(s->avctx,
|
||||
"JPEG-LS that is not <= 8 "
|
||||
"bits/component or 16-bit gray");
|
||||
@@ -301,6 +300,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
s->nb_components = nb_components;
|
||||
s->h_max = 1;
|
||||
s->v_max = 1;
|
||||
memset(h_count, 0, sizeof(h_count));
|
||||
memset(v_count, 0, sizeof(v_count));
|
||||
for (i = 0; i < nb_components; i++) {
|
||||
/* component id */
|
||||
s->component_id[i] = get_bits(&s->gb, 8) - 1;
|
||||
@@ -335,13 +336,12 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
|
||||
|
||||
/* if different size, realloc/alloc picture */
|
||||
if (width != s->width || height != s->height || bits != s->bits ||
|
||||
memcmp(s->h_count, h_count, sizeof(h_count)) ||
|
||||
memcmp(s->v_count, v_count, sizeof(v_count))) {
|
||||
if ( width != s->width || height != s->height
|
||||
|| memcmp(s->h_count, h_count, sizeof(h_count))
|
||||
|| memcmp(s->v_count, v_count, sizeof(v_count))) {
|
||||
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
s->bits = bits;
|
||||
memcpy(s->h_count, h_count, sizeof(h_count));
|
||||
memcpy(s->v_count, v_count, sizeof(v_count));
|
||||
s->interlaced = 0;
|
||||
@@ -376,7 +376,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
else if (!s->lossless)
|
||||
s->rgb = 0;
|
||||
/* XXX: not complete test ! */
|
||||
pix_fmt_id = ((unsigned)s->h_count[0] << 28) | (s->v_count[0] << 24) |
|
||||
pix_fmt_id = (s->h_count[0] << 28) | (s->v_count[0] << 24) |
|
||||
(s->h_count[1] << 20) | (s->v_count[1] << 16) |
|
||||
(s->h_count[2] << 12) | (s->v_count[2] << 8) |
|
||||
(s->h_count[3] << 4) | s->v_count[3];
|
||||
@@ -512,8 +512,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
else s->avctx->pix_fmt = AV_PIX_FMT_YUV420P16;
|
||||
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
|
||||
if (pix_fmt_id == 0x42111100) {
|
||||
if (s->bits > 8)
|
||||
goto unk_pixfmt;
|
||||
s->upscale_h = 6;
|
||||
s->chroma_height = (s->height + 1) / 2;
|
||||
}
|
||||
@@ -1594,8 +1592,6 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
||||
}
|
||||
|
||||
if (id == AV_RB32("LJIF")) {
|
||||
int rgb = s->rgb;
|
||||
int pegasus_rct = s->pegasus_rct;
|
||||
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
|
||||
av_log(s->avctx, AV_LOG_INFO,
|
||||
"Pegasus lossless jpeg header found\n");
|
||||
@@ -1605,27 +1601,17 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
||||
skip_bits(&s->gb, 16); /* unknown always 0? */
|
||||
switch (i=get_bits(&s->gb, 8)) {
|
||||
case 1:
|
||||
rgb = 1;
|
||||
pegasus_rct = 0;
|
||||
s->rgb = 1;
|
||||
s->pegasus_rct = 0;
|
||||
break;
|
||||
case 2:
|
||||
rgb = 1;
|
||||
pegasus_rct = 1;
|
||||
s->rgb = 1;
|
||||
s->pegasus_rct = 1;
|
||||
break;
|
||||
default:
|
||||
av_log(s->avctx, AV_LOG_ERROR, "unknown colorspace %d\n", i);
|
||||
}
|
||||
|
||||
len -= 9;
|
||||
if (s->got_picture)
|
||||
if (rgb != s->rgb || pegasus_rct != s->pegasus_rct) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Mismatching LJIF tag\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
s->rgb = rgb;
|
||||
s->pegasus_rct = pegasus_rct;
|
||||
|
||||
goto out;
|
||||
}
|
||||
if (id == AV_RL32("colr") && len > 0) {
|
||||
|
||||
@@ -241,7 +241,7 @@ AVCodec ff_amv_encoder = {
|
||||
.encode2 = amv_encode_picture,
|
||||
.close = ff_mpv_encode_end,
|
||||
.pix_fmts = (const enum AVPixelFormat[]){
|
||||
AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_NONE
|
||||
AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_NONE
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -61,13 +61,6 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
|
||||
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
|
||||
if (!avctx->width || !avctx->height ||
|
||||
(avctx->width & 1) || (avctx->height & 1)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid video dimensions: %dx%d\n",
|
||||
avctx->width, avctx->height);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
s->frame = av_frame_alloc();
|
||||
if (!s->frame)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -116,7 +109,7 @@ static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert)
|
||||
|
||||
if (color) {
|
||||
memset(s->frame->data[0] + y*s->frame->linesize[0] + x, color, run_length);
|
||||
if (half_vert && y + half_vert < s->avctx->height)
|
||||
if (half_vert)
|
||||
memset(s->frame->data[0] + (y+1)*s->frame->linesize[0] + x, color, run_length);
|
||||
}
|
||||
x+= run_length;
|
||||
|
||||
@@ -193,13 +193,7 @@ static av_always_inline int cmp_inline(MpegEncContext *s, const int x, const int
|
||||
int uvdxy; /* no, it might not be used uninitialized */
|
||||
if(dxy){
|
||||
if(qpel){
|
||||
if (h << size == 16) {
|
||||
c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); //FIXME prototype (add h)
|
||||
} else if (size == 0 && h == 8) {
|
||||
c->qpel_put[1][dxy](c->temp , ref[0] + x + y*stride , stride);
|
||||
c->qpel_put[1][dxy](c->temp + 8, ref[0] + x + y*stride + 8, stride);
|
||||
} else
|
||||
av_assert2(0);
|
||||
c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); //FIXME prototype (add h)
|
||||
if(chroma){
|
||||
int cx= hx/2;
|
||||
int cy= hy/2;
|
||||
|
||||
+5
-21
@@ -1120,10 +1120,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
|
||||
MpegEncContext *s2 = &s->mpeg_enc_ctx;
|
||||
|
||||
ff_mpv_decode_defaults(s2);
|
||||
|
||||
if ( avctx->codec_tag != AV_RL32("VCR2")
|
||||
&& avctx->codec_tag != AV_RL32("BW10"))
|
||||
avctx->coded_width = avctx->coded_height = 0; // do not trust dimensions from input
|
||||
ff_mpv_decode_init(s2, avctx);
|
||||
|
||||
s->mpeg_enc_ctx.avctx = avctx;
|
||||
@@ -1213,16 +1209,6 @@ static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = {
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
static const enum AVPixelFormat mpeg12_pixfmt_list_422[] = {
|
||||
AV_PIX_FMT_YUV422P,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
static const enum AVPixelFormat mpeg12_pixfmt_list_444[] = {
|
||||
AV_PIX_FMT_YUV444P,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
static inline int uses_vdpau(AVCodecContext *avctx) {
|
||||
return avctx->pix_fmt == AV_PIX_FMT_VDPAU_MPEG1 || avctx->pix_fmt == AV_PIX_FMT_VDPAU_MPEG2;
|
||||
}
|
||||
@@ -1231,18 +1217,16 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
|
||||
{
|
||||
Mpeg1Context *s1 = avctx->priv_data;
|
||||
MpegEncContext *s = &s1->mpeg_enc_ctx;
|
||||
const enum AVPixelFormat *pix_fmts;
|
||||
|
||||
if (s->chroma_format < 2)
|
||||
pix_fmts = avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO ?
|
||||
return ff_thread_get_format(avctx,
|
||||
avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO ?
|
||||
mpeg1_hwaccel_pixfmt_list_420 :
|
||||
mpeg2_hwaccel_pixfmt_list_420;
|
||||
mpeg2_hwaccel_pixfmt_list_420);
|
||||
else if (s->chroma_format == 2)
|
||||
pix_fmts = mpeg12_pixfmt_list_422;
|
||||
return AV_PIX_FMT_YUV422P;
|
||||
else
|
||||
pix_fmts = mpeg12_pixfmt_list_444;
|
||||
|
||||
return ff_thread_get_format(avctx, pix_fmts);
|
||||
return AV_PIX_FMT_YUV444P;
|
||||
}
|
||||
|
||||
static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx)
|
||||
|
||||
@@ -88,7 +88,7 @@ static int mpeg4_decode_header(AVCodecParserContext *s1, AVCodecContext *avctx,
|
||||
if (avctx->extradata_size && pc->first_picture) {
|
||||
init_get_bits(gb, avctx->extradata, avctx->extradata_size * 8);
|
||||
ret = ff_mpeg4_decode_picture_header(dec_ctx, gb);
|
||||
if (ret < -1)
|
||||
if (ret < 0)
|
||||
av_log(avctx, AV_LOG_WARNING, "Failed to parse extradata\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -2793,7 +2793,7 @@ AVCodec ff_mpeg4_vdpau_decoder = {
|
||||
.long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 (VDPAU)"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_MPEG4,
|
||||
.priv_data_size = sizeof(Mpeg4DecContext),
|
||||
.priv_data_size = sizeof(MpegEncContext),
|
||||
.init = decode_init,
|
||||
.close = ff_h263_decode_end,
|
||||
.decode = ff_h263_decode_frame,
|
||||
|
||||
@@ -73,21 +73,20 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
|
||||
if (i > 4)
|
||||
s->header_count = -2;
|
||||
} else {
|
||||
int header_threshold = avctx->codec_id != AV_CODEC_ID_NONE && avctx->codec_id != codec_id;
|
||||
if((state&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header)
|
||||
s->header_count= -3;
|
||||
s->header= state;
|
||||
s->header_count++;
|
||||
s->frame_size = ret-4;
|
||||
|
||||
if (s->header_count > header_threshold) {
|
||||
if (s->header_count > 0 + (avctx->codec_id != AV_CODEC_ID_NONE && avctx->codec_id != codec_id)) {
|
||||
avctx->sample_rate= sr;
|
||||
avctx->channels = channels;
|
||||
s1->duration = frame_size;
|
||||
avctx->codec_id = codec_id;
|
||||
if (s->no_bitrate || !avctx->bit_rate) {
|
||||
s->no_bitrate = 1;
|
||||
avctx->bit_rate += (bit_rate - avctx->bit_rate) / (s->header_count - header_threshold);
|
||||
avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -908,11 +908,6 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
|
||||
On2AVCContext *c = avctx->priv_data;
|
||||
int i;
|
||||
|
||||
if (avctx->channels > 2U) {
|
||||
avpriv_request_sample(avctx, "Decoding more than 2 channels");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
c->avctx = avctx;
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
||||
avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO
|
||||
@@ -923,7 +918,6 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
|
||||
av_log(avctx, AV_LOG_ERROR, "0x500 version should be mono\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (avctx->channels == 2)
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"Stereo mode support is not good, patch is welcome\n");
|
||||
|
||||
@@ -105,8 +105,8 @@ static const AVOption avcodec_options[] = {
|
||||
{"extradata_size", NULL, OFFSET(extradata_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
|
||||
{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, INT_MIN, INT_MAX},
|
||||
{"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
|
||||
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
|
||||
{"ac", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
|
||||
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E},
|
||||
{"ac", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E},
|
||||
{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
|
||||
{"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
|
||||
{"frame_number", NULL, OFFSET(frame_number), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
|
||||
|
||||
@@ -499,12 +499,6 @@ static int opus_decode_packet(AVCodecContext *avctx, void *data,
|
||||
av_log(avctx, AV_LOG_ERROR, "Error parsing the packet header.\n");
|
||||
return ret;
|
||||
}
|
||||
if (coded_samples != s->packet.frame_count * s->packet.frame_duration) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Mismatching coded sample count in substream %d.\n", i);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->silk_samplerate = get_silk_samplerate(s->packet.config);
|
||||
}
|
||||
|
||||
|
||||
+2
-9
@@ -582,12 +582,6 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
case MKTAG('I', 'H', 'D', 'R'):
|
||||
if (length != 13)
|
||||
goto fail;
|
||||
|
||||
if (s->state & PNG_IDAT) {
|
||||
av_log(avctx, AV_LOG_ERROR, "IHDR after IDAT\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
s->width = bytestream2_get_be32(&s->gb);
|
||||
s->height = bytestream2_get_be32(&s->gb);
|
||||
if (av_image_check_size(s->width, s->height, 0, avctx)) {
|
||||
@@ -656,7 +650,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
} else if ((s->bits_per_pixel == 1 || s->bits_per_pixel == 2 || s->bits_per_pixel == 4 || s->bits_per_pixel == 8) &&
|
||||
s->color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
} else if (s->bit_depth == 1 && s->bits_per_pixel == 1) {
|
||||
} else if (s->bit_depth == 1) {
|
||||
avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
|
||||
} else if (s->bit_depth == 8 &&
|
||||
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
||||
@@ -866,11 +860,10 @@ exit_loop:
|
||||
int i, j;
|
||||
uint8_t *pd = p->data[0];
|
||||
uint8_t *pd_last = s->last_picture.f->data[0];
|
||||
int ls = FFMIN(av_image_get_linesize(p->format, s->width, 0), s->width * s->bpp);
|
||||
|
||||
ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
|
||||
for (j = 0; j < s->height; j++) {
|
||||
for (i = 0; i < ls; i++)
|
||||
for (i = 0; i < s->width * s->bpp; i++)
|
||||
pd[i] += pd_last[i];
|
||||
pd += s->image_linesize;
|
||||
pd_last += s->image_linesize;
|
||||
|
||||
+1
-1
@@ -163,7 +163,7 @@ static void av_noinline qpeg_decode_inter(QpegContext *qctx, uint8_t *dst,
|
||||
|
||||
/* check motion vector */
|
||||
if ((me_x + filled < 0) || (me_x + me_w + filled > width) ||
|
||||
(height - me_y - me_h < 0) || (height - me_y >= orig_height) ||
|
||||
(height - me_y - me_h < 0) || (height - me_y > orig_height) ||
|
||||
(filled + me_w > width) || (height - me_h < 0))
|
||||
av_log(NULL, AV_LOG_ERROR, "Bogus motion vector (%i,%i), block size %ix%i at %i,%i\n",
|
||||
me_x, me_y, me_w, me_h, filled, height);
|
||||
|
||||
@@ -172,9 +172,6 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
context->frame_size = avpicture_get_size(avctx->pix_fmt, avctx->width,
|
||||
avctx->height);
|
||||
}
|
||||
if (context->frame_size < 0)
|
||||
return context->frame_size;
|
||||
|
||||
need_copy = !avpkt->buf || context->is_2_4_bpp || context->is_yuv2 || context->is_lt_16bpp;
|
||||
|
||||
frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
|
||||
+2
-2
@@ -98,7 +98,7 @@ static int expand_rle_row16(SgiState *s, uint16_t *out_buf,
|
||||
break;
|
||||
|
||||
/* Check for buffer overflow. */
|
||||
if (out_end - out_buf <= pixelstride * (count - 1)) {
|
||||
if (pixelstride * (count - 1) >= len) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid pixel count.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ static int read_rle_sgi(uint8_t *out_buf, SgiState *s)
|
||||
for (z = 0; z < s->depth; z++) {
|
||||
dest_row = out_buf;
|
||||
for (y = 0; y < s->height; y++) {
|
||||
linesize = s->width * s->depth;
|
||||
linesize = s->width * s->depth * s->bytes_per_channel;
|
||||
dest_row -= s->linesize;
|
||||
start_offset = bytestream2_get_be32(&g_table);
|
||||
bytestream2_seek(&s->g, start_offset, SEEK_SET);
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ typedef struct SmcContext {
|
||||
row_ptr += stride * 4; \
|
||||
} \
|
||||
total_blocks--; \
|
||||
if (total_blocks < !!n_blocks) \
|
||||
if (total_blocks < 0) \
|
||||
{ \
|
||||
av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \
|
||||
return; \
|
||||
|
||||
@@ -499,7 +499,7 @@ static int svq1_decode_delta_block(AVCodecContext *avctx, HpelDSPContext *hdsp,
|
||||
return result;
|
||||
}
|
||||
|
||||
static void svq1_parse_string(GetBitContext *bitbuf, uint8_t out[257])
|
||||
static void svq1_parse_string(GetBitContext *bitbuf, uint8_t *out)
|
||||
{
|
||||
uint8_t seed;
|
||||
int i;
|
||||
@@ -511,7 +511,6 @@ static void svq1_parse_string(GetBitContext *bitbuf, uint8_t out[257])
|
||||
out[i] = get_bits(bitbuf, 8) ^ seed;
|
||||
seed = string_table[out[i] ^ seed];
|
||||
}
|
||||
out[i] = 0;
|
||||
}
|
||||
|
||||
static int svq1_decode_frame_header(AVCodecContext *avctx, AVFrame *frame)
|
||||
@@ -554,12 +553,12 @@ static int svq1_decode_frame_header(AVCodecContext *avctx, AVFrame *frame)
|
||||
}
|
||||
|
||||
if ((s->frame_code ^ 0x10) >= 0x50) {
|
||||
uint8_t msg[257];
|
||||
uint8_t msg[256];
|
||||
|
||||
svq1_parse_string(bitbuf, msg);
|
||||
|
||||
av_log(avctx, AV_LOG_INFO,
|
||||
"embedded message:\n%s\n", ((char *)msg) + 1);
|
||||
"embedded message:\n%s\n", (char *)msg);
|
||||
}
|
||||
|
||||
skip_bits(bitbuf, 2);
|
||||
|
||||
+1
-1
@@ -1176,7 +1176,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
h->cur_pic_ptr = s->cur_pic;
|
||||
av_frame_unref(&h->cur_pic.f);
|
||||
memcpy(&h->cur_pic.tf, &s->cur_pic->tf, sizeof(h->cur_pic) - offsetof(H264Picture, tf));
|
||||
h->cur_pic = *s->cur_pic;
|
||||
ret = av_frame_ref(&h->cur_pic.f, &s->cur_pic->f);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+3
-10
@@ -812,13 +812,13 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
s->height = value;
|
||||
break;
|
||||
case TIFF_BPP:
|
||||
if (count > 4U) {
|
||||
s->bppcount = count;
|
||||
if (count > 4) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"This format is not supported (bpp=%d, %d components)\n",
|
||||
value, count);
|
||||
s->bpp, count);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->bppcount = count;
|
||||
if (count == 1)
|
||||
s->bpp = value;
|
||||
else {
|
||||
@@ -836,13 +836,6 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
s->bpp = -1;
|
||||
}
|
||||
}
|
||||
if (s->bpp > 64U) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"This format is not supported (bpp=%d, %d components)\n",
|
||||
s->bpp, count);
|
||||
s->bpp = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
break;
|
||||
case TIFF_SAMPLES_PER_PIXEL:
|
||||
if (count != 1) {
|
||||
|
||||
@@ -305,9 +305,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
|
||||
strips = (s->height - 1) / s->rps + 1;
|
||||
|
||||
bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp *
|
||||
s->subsampling[0] * s->subsampling[1] + 7) >> 3;
|
||||
packet_size = avctx->height * bytes_per_row * 2 +
|
||||
packet_size = avctx->height * ((avctx->width * s->bpp + 7) >> 3) * 2 +
|
||||
avctx->height * 4 + FF_MIN_BUFFER_SIZE;
|
||||
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, packet_size)) < 0)
|
||||
@@ -335,6 +333,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp *
|
||||
s->subsampling[0] * s->subsampling[1] + 7) >> 3;
|
||||
if (is_yuv) {
|
||||
av_fast_padded_malloc(&s->yuv_line, &s->yuv_line_size, bytes_per_row);
|
||||
if (s->yuv_line == NULL) {
|
||||
|
||||
+2
-18
@@ -66,9 +66,6 @@
|
||||
#include "compat/os2threads.h"
|
||||
#endif
|
||||
|
||||
#include "libavutil/ffversion.h"
|
||||
const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
||||
|
||||
#if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS
|
||||
static int default_lockmgr_cb(void **arg, enum AVLockOp op)
|
||||
{
|
||||
@@ -282,12 +279,6 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
int i;
|
||||
int w_align = 1;
|
||||
int h_align = 1;
|
||||
AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt);
|
||||
|
||||
if (desc) {
|
||||
w_align = 1 << desc->log2_chroma_w;
|
||||
h_align = 1 << desc->log2_chroma_h;
|
||||
}
|
||||
|
||||
switch (s->pix_fmt) {
|
||||
case AV_PIX_FMT_YUV420P:
|
||||
@@ -396,10 +387,6 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
w_align = 4;
|
||||
h_align = 4;
|
||||
}
|
||||
if (s->codec_id == AV_CODEC_ID_JV) {
|
||||
w_align = 8;
|
||||
h_align = 8;
|
||||
}
|
||||
break;
|
||||
case AV_PIX_FMT_BGR24:
|
||||
if ((s->codec_id == AV_CODEC_ID_MSZH) ||
|
||||
@@ -415,6 +402,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
w_align = 1;
|
||||
h_align = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3613,11 +3602,6 @@ int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
|
||||
ret = av_bprint_finalize(buf, &str);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (!av_bprint_is_complete(buf)) {
|
||||
av_free(str);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
avctx->extradata = str;
|
||||
/* Note: the string is NUL terminated (so extradata can be read as a
|
||||
* string), but the ending character is not accounted in the size (in
|
||||
|
||||
@@ -214,8 +214,6 @@ static void restore_median(uint8_t *src, int step, int stride,
|
||||
slice_height = ((((slice + 1) * height) / slices) & cmask) -
|
||||
slice_start;
|
||||
|
||||
if (!slice_height)
|
||||
continue;
|
||||
bsrc = src + slice_start * stride;
|
||||
|
||||
// first line - left neighbour prediction
|
||||
@@ -226,7 +224,7 @@ static void restore_median(uint8_t *src, int step, int stride,
|
||||
A = bsrc[i];
|
||||
}
|
||||
bsrc += stride;
|
||||
if (slice_height <= 1)
|
||||
if (slice_height == 1)
|
||||
continue;
|
||||
// second line - first element has top prediction, the rest uses median
|
||||
C = bsrc[-stride];
|
||||
@@ -271,8 +269,6 @@ static void restore_median_il(uint8_t *src, int step, int stride,
|
||||
slice_height = ((((slice + 1) * height) / slices) & cmask) -
|
||||
slice_start;
|
||||
slice_height >>= 1;
|
||||
if (!slice_height)
|
||||
continue;
|
||||
|
||||
bsrc = src + slice_start * stride;
|
||||
|
||||
@@ -288,7 +284,7 @@ static void restore_median_il(uint8_t *src, int step, int stride,
|
||||
A = bsrc[stride + i];
|
||||
}
|
||||
bsrc += stride2;
|
||||
if (slice_height <= 1)
|
||||
if (slice_height == 1)
|
||||
continue;
|
||||
// second line - first element has top prediction, the rest uses median
|
||||
C = bsrc[-stride2];
|
||||
|
||||
@@ -389,7 +389,7 @@ static int write_huff_codes(uint8_t *src, uint8_t *dst, int dst_size,
|
||||
}
|
||||
|
||||
static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
uint8_t *dst, int stride, int plane_no,
|
||||
uint8_t *dst, int stride,
|
||||
int width, int height, PutByteContext *pb)
|
||||
{
|
||||
UtvideoContext *c = avctx->priv_data;
|
||||
@@ -399,7 +399,6 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
HuffEntry he[256];
|
||||
|
||||
uint32_t offset = 0, slice_len = 0;
|
||||
const int cmask = ~(!plane_no && avctx->pix_fmt == AV_PIX_FMT_YUV420P);
|
||||
int i, sstart, send = 0;
|
||||
int symbol;
|
||||
int ret;
|
||||
@@ -409,7 +408,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
case PRED_NONE:
|
||||
for (i = 0; i < c->slices; i++) {
|
||||
sstart = send;
|
||||
send = height * (i + 1) / c->slices & cmask;
|
||||
send = height * (i + 1) / c->slices;
|
||||
av_image_copy_plane(dst + sstart * width, width,
|
||||
src + sstart * stride, stride,
|
||||
width, send - sstart);
|
||||
@@ -418,7 +417,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
case PRED_LEFT:
|
||||
for (i = 0; i < c->slices; i++) {
|
||||
sstart = send;
|
||||
send = height * (i + 1) / c->slices & cmask;
|
||||
send = height * (i + 1) / c->slices;
|
||||
left_predict(src + sstart * stride, dst + sstart * width,
|
||||
stride, width, send - sstart);
|
||||
}
|
||||
@@ -426,7 +425,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
case PRED_MEDIAN:
|
||||
for (i = 0; i < c->slices; i++) {
|
||||
sstart = send;
|
||||
send = height * (i + 1) / c->slices & cmask;
|
||||
send = height * (i + 1) / c->slices;
|
||||
median_predict(c, src + sstart * stride, dst + sstart * width,
|
||||
stride, width, send - sstart);
|
||||
}
|
||||
@@ -490,7 +489,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
send = 0;
|
||||
for (i = 0; i < c->slices; i++) {
|
||||
sstart = send;
|
||||
send = height * (i + 1) / c->slices & cmask;
|
||||
send = height * (i + 1) / c->slices;
|
||||
|
||||
/*
|
||||
* Write the huffman codes to a buffer,
|
||||
@@ -572,7 +571,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
case AV_PIX_FMT_RGBA:
|
||||
for (i = 0; i < c->planes; i++) {
|
||||
ret = encode_plane(avctx, c->slice_buffer[i] + 2 * c->slice_stride,
|
||||
c->slice_buffer[i], c->slice_stride, i,
|
||||
c->slice_buffer[i], c->slice_stride,
|
||||
width, height, &pb);
|
||||
|
||||
if (ret) {
|
||||
@@ -584,7 +583,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
case AV_PIX_FMT_YUV422P:
|
||||
for (i = 0; i < c->planes; i++) {
|
||||
ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
|
||||
pic->linesize[i], i, width >> !!i, height, &pb);
|
||||
pic->linesize[i], width >> !!i, height, &pb);
|
||||
|
||||
if (ret) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error encoding plane %d.\n", i);
|
||||
@@ -595,7 +594,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
case AV_PIX_FMT_YUV420P:
|
||||
for (i = 0; i < c->planes; i++) {
|
||||
ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
|
||||
pic->linesize[i], i, width >> !!i, height >> !!i,
|
||||
pic->linesize[i], width >> !!i, height >> !!i,
|
||||
&pb);
|
||||
|
||||
if (ret) {
|
||||
|
||||
@@ -339,9 +339,6 @@ static int vmd_decode(VmdVideoContext *s, AVFrame *frame)
|
||||
ofs += slen;
|
||||
bytestream2_skip(&gb, len);
|
||||
} else {
|
||||
if (ofs + len > frame_width ||
|
||||
bytestream2_get_bytes_left(&gb) < len)
|
||||
return AVERROR_INVALIDDATA;
|
||||
bytestream2_get_buffer(&gb, &dp[ofs], len);
|
||||
ofs += len;
|
||||
}
|
||||
|
||||
@@ -1314,9 +1314,7 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
|
||||
vorbis_residue *vr,
|
||||
uint8_t *do_not_decode,
|
||||
unsigned ch_used,
|
||||
int partition_count,
|
||||
int ptns_to_read
|
||||
)
|
||||
int partition_count)
|
||||
{
|
||||
int p, j, i;
|
||||
unsigned c_p_c = vc->codebooks[vr->classbook].dimensions;
|
||||
@@ -1338,7 +1336,7 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
|
||||
for (i = partition_count + c_p_c - 1; i >= partition_count; i--) {
|
||||
temp2 = (((uint64_t)temp) * inverse_class) >> 32;
|
||||
|
||||
if (i < ptns_to_read)
|
||||
if (i < vr->ptns_to_read)
|
||||
vr->classifs[p + i] = temp - temp2 * vr->classifications;
|
||||
temp = temp2;
|
||||
}
|
||||
@@ -1346,13 +1344,13 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
|
||||
for (i = partition_count + c_p_c - 1; i >= partition_count; i--) {
|
||||
temp2 = temp / vr->classifications;
|
||||
|
||||
if (i < ptns_to_read)
|
||||
if (i < vr->ptns_to_read)
|
||||
vr->classifs[p + i] = temp - temp2 * vr->classifications;
|
||||
temp = temp2;
|
||||
}
|
||||
}
|
||||
}
|
||||
p += ptns_to_read;
|
||||
p += vr->ptns_to_read;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1406,7 +1404,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
for (partition_count = 0; partition_count < ptns_to_read;) { // SPEC error
|
||||
if (!pass) {
|
||||
int ret;
|
||||
if ((ret = setup_classifs(vc, vr, do_not_decode, ch_used, partition_count, ptns_to_read)) < 0)
|
||||
if ((ret = setup_classifs(vc, vr, do_not_decode, ch_used, partition_count)) < 0)
|
||||
return ret;
|
||||
}
|
||||
for (i = 0; (i < c_p_c) && (partition_count < ptns_to_read); ++i) {
|
||||
|
||||
@@ -77,8 +77,6 @@ static int parse(AVCodecParserContext *ctx,
|
||||
idx += a; \
|
||||
if (sz > size) { \
|
||||
s->n_frames = 0; \
|
||||
*out_size = 0; \
|
||||
*out_data = data; \
|
||||
av_log(avctx, AV_LOG_ERROR, \
|
||||
"Superframe packet size too big: %u > %d\n", \
|
||||
sz, size); \
|
||||
|
||||
+5
-5
@@ -1028,7 +1028,7 @@ static int apply_color_indexing_transform(WebPContext *s)
|
||||
ImageContext *img;
|
||||
ImageContext *pal;
|
||||
int i, x, y;
|
||||
uint8_t *p;
|
||||
uint8_t *p, *pi;
|
||||
|
||||
img = &s->image[IMAGE_ROLE_ARGB];
|
||||
pal = &s->image[IMAGE_ROLE_COLOR_INDEXING];
|
||||
@@ -1066,11 +1066,11 @@ static int apply_color_indexing_transform(WebPContext *s)
|
||||
p = GET_PIXEL(img->frame, x, y);
|
||||
i = p[2];
|
||||
if (i >= pal->frame->width) {
|
||||
AV_WB32(p, 0x00000000);
|
||||
} else {
|
||||
const uint8_t *pi = GET_PIXEL(pal->frame, i, 0);
|
||||
AV_COPY32(p, pi);
|
||||
av_log(s->avctx, AV_LOG_ERROR, "invalid palette index %d\n", i);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
pi = GET_PIXEL(pal->frame, i, 0);
|
||||
AV_COPY32(p, pi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -422,9 +422,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
offset &= ~3;
|
||||
if (offset > s->sfb_offsets[i][band - 1])
|
||||
s->sfb_offsets[i][band++] = offset;
|
||||
|
||||
if (offset >= subframe_len)
|
||||
break;
|
||||
}
|
||||
s->sfb_offsets[i][band - 1] = subframe_len;
|
||||
s->num_sfb[i] = band - 1;
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
;******************************************************************************
|
||||
|
||||
%include "libavutil/x86/x86util.asm"
|
||||
|
||||
%if ARCH_X86_64
|
||||
|
||||
%include "libavutil/x86/x86util.asm"
|
||||
|
||||
SECTION_RODATA
|
||||
|
||||
cextern pb_3
|
||||
|
||||
@@ -34,7 +34,7 @@ OBJS-$(CONFIG_OPENGL_OUTDEV) += opengl_enc.o
|
||||
OBJS-$(CONFIG_OSS_INDEV) += oss_audio.o oss_audio_dec.o
|
||||
OBJS-$(CONFIG_OSS_OUTDEV) += oss_audio.o oss_audio_enc.o
|
||||
OBJS-$(CONFIG_PULSE_INDEV) += pulse_audio_dec.o \
|
||||
pulse_audio_common.o timefilter.o
|
||||
pulse_audio_common.o
|
||||
OBJS-$(CONFIG_PULSE_OUTDEV) += pulse_audio_enc.o \
|
||||
pulse_audio_common.o
|
||||
OBJS-$(CONFIG_QTKIT_INDEV) += qtkit.o
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
#include "avdevice.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "libavutil/ffversion.h"
|
||||
const char av_device_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
||||
|
||||
#define E AV_OPT_FLAG_ENCODING_PARAM
|
||||
#define D AV_OPT_FLAG_DECODING_PARAM
|
||||
#define A AV_OPT_FLAG_AUDIO_PARAM
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
LIBAVDEVICE_$MAJOR {
|
||||
global: avdevice_*; av_*;
|
||||
global: avdevice_*;
|
||||
local: *;
|
||||
};
|
||||
|
||||
+3
-3
@@ -873,6 +873,9 @@ static int v4l2_read_header(AVFormatContext *ctx)
|
||||
|
||||
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
|
||||
|
||||
if ((res = v4l2_set_parameters(ctx)) < 0)
|
||||
goto fail;
|
||||
|
||||
if (s->pixel_format) {
|
||||
AVCodec *codec = avcodec_find_decoder_by_name(s->pixel_format);
|
||||
|
||||
@@ -923,9 +926,6 @@ static int v4l2_read_header(AVFormatContext *ctx)
|
||||
|
||||
s->frame_format = desired_format;
|
||||
|
||||
if ((res = v4l2_set_parameters(ctx)) < 0)
|
||||
goto fail;
|
||||
|
||||
st->codec->pix_fmt = avpriv_fmt_v4l2ff(desired_format, codec_id);
|
||||
s->frame_size =
|
||||
avpicture_get_size(st->codec->pix_fmt, s->width, s->height);
|
||||
|
||||
@@ -496,8 +496,6 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
snprintf(name, sizeof(name), "input%d", i);
|
||||
pad.type = AVMEDIA_TYPE_AUDIO;
|
||||
pad.name = av_strdup(name);
|
||||
if (!pad.name)
|
||||
return AVERROR(ENOMEM);
|
||||
pad.filter_frame = filter_frame;
|
||||
|
||||
ff_insert_inpad(ctx, i, &pad);
|
||||
|
||||
@@ -214,8 +214,6 @@ static av_cold int join_init(AVFilterContext *ctx)
|
||||
snprintf(name, sizeof(name), "input%d", i);
|
||||
pad.type = AVMEDIA_TYPE_AUDIO;
|
||||
pad.name = av_strdup(name);
|
||||
if (!pad.name)
|
||||
return AVERROR(ENOMEM);
|
||||
pad.filter_frame = filter_frame;
|
||||
|
||||
pad.needs_fifo = 1;
|
||||
|
||||
@@ -41,7 +41,6 @@ typedef struct ResampleContext {
|
||||
AVDictionary *options;
|
||||
|
||||
int64_t next_pts;
|
||||
int64_t next_in_pts;
|
||||
|
||||
/* set by filter_frame() to signal an output frame to request_frame() */
|
||||
int got_output;
|
||||
@@ -154,7 +153,6 @@ static int config_output(AVFilterLink *outlink)
|
||||
|
||||
outlink->time_base = (AVRational){ 1, outlink->sample_rate };
|
||||
s->next_pts = AV_NOPTS_VALUE;
|
||||
s->next_in_pts = AV_NOPTS_VALUE;
|
||||
|
||||
av_get_channel_layout_string(buf1, sizeof(buf1),
|
||||
-1, inlink ->channel_layout);
|
||||
@@ -256,12 +254,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
}
|
||||
|
||||
out->sample_rate = outlink->sample_rate;
|
||||
/* Only convert in->pts if there is a discontinuous jump.
|
||||
This ensures that out->pts tracks the number of samples actually
|
||||
output by the resampler in the absence of such a jump.
|
||||
Otherwise, the rounding in av_rescale_q() and av_rescale()
|
||||
causes off-by-1 errors. */
|
||||
if (in->pts != AV_NOPTS_VALUE && in->pts != s->next_in_pts) {
|
||||
if (in->pts != AV_NOPTS_VALUE) {
|
||||
out->pts = av_rescale_q(in->pts, inlink->time_base,
|
||||
outlink->time_base) -
|
||||
av_rescale(delay, outlink->sample_rate,
|
||||
@@ -270,7 +263,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
out->pts = s->next_pts;
|
||||
|
||||
s->next_pts = out->pts + out->nb_samples;
|
||||
s->next_in_pts = in->pts + in->nb_samples;
|
||||
|
||||
ret = ff_filter_frame(outlink, out);
|
||||
s->got_output = 1;
|
||||
|
||||
@@ -37,9 +37,6 @@
|
||||
#include "formats.h"
|
||||
#include "internal.h"
|
||||
|
||||
#include "libavutil/ffversion.h"
|
||||
const char av_filter_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
||||
|
||||
static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame);
|
||||
|
||||
void ff_tlog_ref(void *ctx, AVFrame *ref, int end)
|
||||
|
||||
@@ -48,7 +48,7 @@ typedef struct {
|
||||
} MotionVector;
|
||||
|
||||
typedef struct {
|
||||
MotionVector vec; ///< Motion vector
|
||||
MotionVector vector; ///< Motion vector
|
||||
double angle; ///< Angle of rotation
|
||||
double zoom; ///< Zoom percentage
|
||||
} Transform;
|
||||
|
||||
@@ -52,8 +52,6 @@ static av_cold int split_init(AVFilterContext *ctx)
|
||||
snprintf(name, sizeof(name), "output%d", i);
|
||||
pad.type = ctx->filter->inputs[0].type;
|
||||
pad.name = av_strdup(name);
|
||||
if (!pad.name)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ff_insert_outpad(ctx, i, &pad);
|
||||
}
|
||||
|
||||
@@ -289,8 +289,6 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
|
||||
snprintf(name, sizeof(name), "out%d", i);
|
||||
pad.type = movie->st[i].st->codec->codec_type;
|
||||
pad.name = av_strdup(name);
|
||||
if (!pad.name)
|
||||
return AVERROR(ENOMEM);
|
||||
pad.config_props = movie_config_output_props;
|
||||
pad.request_frame = movie_request_frame;
|
||||
ff_insert_outpad(ctx, i, &pad);
|
||||
|
||||
+25
-25
@@ -294,8 +294,8 @@ static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2,
|
||||
for (x = 0; x < deshake->rx * 2 + 1; x++) {
|
||||
//av_log(NULL, AV_LOG_ERROR, "%5d ", deshake->counts[x][y]);
|
||||
if (deshake->counts[x][y] > count_max_value) {
|
||||
t->vec.x = x - deshake->rx;
|
||||
t->vec.y = y - deshake->ry;
|
||||
t->vector.x = x - deshake->rx;
|
||||
t->vector.y = y - deshake->ry;
|
||||
count_max_value = deshake->counts[x][y];
|
||||
}
|
||||
}
|
||||
@@ -304,12 +304,12 @@ static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2,
|
||||
|
||||
p_x = (center_x - width / 2.0);
|
||||
p_y = (center_y - height / 2.0);
|
||||
t->vec.x += (cos(t->angle)-1)*p_x - sin(t->angle)*p_y;
|
||||
t->vec.y += sin(t->angle)*p_x + (cos(t->angle)-1)*p_y;
|
||||
t->vector.x += (cos(t->angle)-1)*p_x - sin(t->angle)*p_y;
|
||||
t->vector.y += sin(t->angle)*p_x + (cos(t->angle)-1)*p_y;
|
||||
|
||||
// Clamp max shift & rotation?
|
||||
t->vec.x = av_clipf(t->vec.x, -deshake->rx * 2, deshake->rx * 2);
|
||||
t->vec.y = av_clipf(t->vec.y, -deshake->ry * 2, deshake->ry * 2);
|
||||
t->vector.x = av_clipf(t->vector.x, -deshake->rx * 2, deshake->rx * 2);
|
||||
t->vector.y = av_clipf(t->vector.y, -deshake->ry * 2, deshake->ry * 2);
|
||||
t->angle = av_clipf(t->angle, -0.1, 0.1);
|
||||
|
||||
//av_log(NULL, AV_LOG_ERROR, "%d x %d\n", avg->x, avg->y);
|
||||
@@ -407,8 +407,8 @@ static int config_props(AVFilterLink *link)
|
||||
DeshakeContext *deshake = link->dst->priv;
|
||||
|
||||
deshake->ref = NULL;
|
||||
deshake->last.vec.x = 0;
|
||||
deshake->last.vec.y = 0;
|
||||
deshake->last.vector.x = 0;
|
||||
deshake->last.vector.y = 0;
|
||||
deshake->last.angle = 0;
|
||||
deshake->last.zoom = 0;
|
||||
|
||||
@@ -476,57 +476,57 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
|
||||
|
||||
|
||||
// Copy transform so we can output it later to compare to the smoothed value
|
||||
orig.vec.x = t.vec.x;
|
||||
orig.vec.y = t.vec.y;
|
||||
orig.vector.x = t.vector.x;
|
||||
orig.vector.y = t.vector.y;
|
||||
orig.angle = t.angle;
|
||||
orig.zoom = t.zoom;
|
||||
|
||||
// Generate a one-sided moving exponential average
|
||||
deshake->avg.vec.x = alpha * t.vec.x + (1.0 - alpha) * deshake->avg.vec.x;
|
||||
deshake->avg.vec.y = alpha * t.vec.y + (1.0 - alpha) * deshake->avg.vec.y;
|
||||
deshake->avg.vector.x = alpha * t.vector.x + (1.0 - alpha) * deshake->avg.vector.x;
|
||||
deshake->avg.vector.y = alpha * t.vector.y + (1.0 - alpha) * deshake->avg.vector.y;
|
||||
deshake->avg.angle = alpha * t.angle + (1.0 - alpha) * deshake->avg.angle;
|
||||
deshake->avg.zoom = alpha * t.zoom + (1.0 - alpha) * deshake->avg.zoom;
|
||||
|
||||
// Remove the average from the current motion to detect the motion that
|
||||
// is not on purpose, just as jitter from bumping the camera
|
||||
t.vec.x -= deshake->avg.vec.x;
|
||||
t.vec.y -= deshake->avg.vec.y;
|
||||
t.vector.x -= deshake->avg.vector.x;
|
||||
t.vector.y -= deshake->avg.vector.y;
|
||||
t.angle -= deshake->avg.angle;
|
||||
t.zoom -= deshake->avg.zoom;
|
||||
|
||||
// Invert the motion to undo it
|
||||
t.vec.x *= -1;
|
||||
t.vec.y *= -1;
|
||||
t.vector.x *= -1;
|
||||
t.vector.y *= -1;
|
||||
t.angle *= -1;
|
||||
|
||||
// Write statistics to file
|
||||
if (deshake->fp) {
|
||||
snprintf(tmp, 256, "%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n", orig.vec.x, deshake->avg.vec.x, t.vec.x, orig.vec.y, deshake->avg.vec.y, t.vec.y, orig.angle, deshake->avg.angle, t.angle, orig.zoom, deshake->avg.zoom, t.zoom);
|
||||
snprintf(tmp, 256, "%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n", orig.vector.x, deshake->avg.vector.x, t.vector.x, orig.vector.y, deshake->avg.vector.y, t.vector.y, orig.angle, deshake->avg.angle, t.angle, orig.zoom, deshake->avg.zoom, t.zoom);
|
||||
fwrite(tmp, sizeof(char), strlen(tmp), deshake->fp);
|
||||
}
|
||||
|
||||
// Turn relative current frame motion into absolute by adding it to the
|
||||
// last absolute motion
|
||||
t.vec.x += deshake->last.vec.x;
|
||||
t.vec.y += deshake->last.vec.y;
|
||||
t.vector.x += deshake->last.vector.x;
|
||||
t.vector.y += deshake->last.vector.y;
|
||||
t.angle += deshake->last.angle;
|
||||
t.zoom += deshake->last.zoom;
|
||||
|
||||
// Shrink motion by 10% to keep things centered in the camera frame
|
||||
t.vec.x *= 0.9;
|
||||
t.vec.y *= 0.9;
|
||||
t.vector.x *= 0.9;
|
||||
t.vector.y *= 0.9;
|
||||
t.angle *= 0.9;
|
||||
|
||||
// Store the last absolute motion information
|
||||
deshake->last.vec.x = t.vec.x;
|
||||
deshake->last.vec.y = t.vec.y;
|
||||
deshake->last.vector.x = t.vector.x;
|
||||
deshake->last.vector.y = t.vector.y;
|
||||
deshake->last.angle = t.angle;
|
||||
deshake->last.zoom = t.zoom;
|
||||
|
||||
// Generate a luma transformation matrix
|
||||
avfilter_get_matrix(t.vec.x, t.vec.y, t.angle, 1.0 + t.zoom / 100.0, matrix_y);
|
||||
avfilter_get_matrix(t.vector.x, t.vector.y, t.angle, 1.0 + t.zoom / 100.0, matrix_y);
|
||||
// Generate a chroma transformation matrix
|
||||
avfilter_get_matrix(t.vec.x / (link->w / CHROMA_WIDTH(link)), t.vec.y / (link->h / CHROMA_HEIGHT(link)), t.angle, 1.0 + t.zoom / 100.0, matrix_uv);
|
||||
avfilter_get_matrix(t.vector.x / (link->w / CHROMA_WIDTH(link)), t.vector.y / (link->h / CHROMA_HEIGHT(link)), t.angle, 1.0 + t.zoom / 100.0, matrix_uv);
|
||||
// Transform the luma and chroma planes
|
||||
ret = deshake->transform(link->dst, link->w, link->h, CHROMA_WIDTH(link), CHROMA_HEIGHT(link),
|
||||
matrix_y, matrix_uv, INTERPOLATE_BILINEAR, deshake->edge, in, out);
|
||||
|
||||
@@ -716,8 +716,6 @@ static av_cold void uninit(AVFilterContext *ctx)
|
||||
#if FF_API_DRAWTEXT_OLD_TIMELINE
|
||||
av_expr_free(s->draw_pexpr);
|
||||
s->x_pexpr = s->y_pexpr = s->draw_pexpr = NULL;
|
||||
#else
|
||||
s->x_pexpr = s->y_pexpr = NULL;
|
||||
#endif
|
||||
av_freep(&s->positions);
|
||||
s->nb_positions = 0;
|
||||
|
||||
@@ -161,32 +161,15 @@ static double compute_gammaval(void *opaque, double gamma)
|
||||
return pow((val-minval)/(maxval-minval), gamma) * (maxval-minval)+minval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute Rec.709 gama correction of value val
|
||||
*/
|
||||
static double compute_gammaval709(void *opaque, double gamma)
|
||||
{
|
||||
LutContext *s = opaque;
|
||||
double val = s->var_values[VAR_CLIPVAL];
|
||||
double minval = s->var_values[VAR_MINVAL];
|
||||
double maxval = s->var_values[VAR_MAXVAL];
|
||||
double level = (val - minval) / (maxval - minval);
|
||||
level = level < 0.018 ? 4.5 * level
|
||||
: 1.099 * pow(level, 1.0 / gamma) - 0.099;
|
||||
return level * (maxval - minval) + minval;
|
||||
}
|
||||
|
||||
static double (* const funcs1[])(void *, double) = {
|
||||
(void *)clip,
|
||||
(void *)compute_gammaval,
|
||||
(void *)compute_gammaval709,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char * const funcs1_names[] = {
|
||||
"clip",
|
||||
"gammaval",
|
||||
"gammaval709",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
+6
-16
@@ -220,19 +220,6 @@ static int config_props(AVFilterLink *inlink)
|
||||
|
||||
#define NB_PLANES 4
|
||||
|
||||
static inline int mirror(int x, int w)
|
||||
{
|
||||
if (!w)
|
||||
return 0;
|
||||
|
||||
while ((unsigned)x > (unsigned)w) {
|
||||
x = -x;
|
||||
if (x < 0)
|
||||
x += 2 * w;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
static void blur(uint8_t *dst, const int dst_linesize,
|
||||
const uint8_t *src, const int src_linesize,
|
||||
const int w, const int h, FilterParam *fp)
|
||||
@@ -266,7 +253,8 @@ static void blur(uint8_t *dst, const int dst_linesize,
|
||||
for (dy = 0; dy < radius*2 + 1; dy++) {
|
||||
int dx;
|
||||
int iy = y+dy - radius;
|
||||
iy = mirror(iy, h-1);
|
||||
if (iy < 0) iy = -iy;
|
||||
else if (iy >= h) iy = h+h-iy-1;
|
||||
|
||||
for (dx = 0; dx < radius*2 + 1; dx++) {
|
||||
const int ix = x+dx - radius;
|
||||
@@ -277,11 +265,13 @@ static void blur(uint8_t *dst, const int dst_linesize,
|
||||
for (dy = 0; dy < radius*2+1; dy++) {
|
||||
int dx;
|
||||
int iy = y+dy - radius;
|
||||
iy = mirror(iy, h-1);
|
||||
if (iy < 0) iy = -iy;
|
||||
else if (iy >= h) iy = h+h-iy-1;
|
||||
|
||||
for (dx = 0; dx < radius*2 + 1; dx++) {
|
||||
int ix = x+dx - radius;
|
||||
ix = mirror(ix, w-1);
|
||||
if (ix < 0) ix = -ix;
|
||||
else if (ix >= w) ix = w+w-ix-1;
|
||||
UPDATE_FACTOR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,10 +557,10 @@ static const AVOption scale_options[] = {
|
||||
{ "mpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_MPEG}, 0, 0, FLAGS, "range" },
|
||||
{ "tv", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_MPEG}, 0, 0, FLAGS, "range" },
|
||||
{ "pc", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_JPEG}, 0, 0, FLAGS, "range" },
|
||||
{ "in_v_chr_pos", "input vertical chroma position in luma grid/256" , OFFSET(in_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513}, -513, 512, FLAGS },
|
||||
{ "in_h_chr_pos", "input horizontal chroma position in luma grid/256", OFFSET(in_h_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513}, -513, 512, FLAGS },
|
||||
{ "out_v_chr_pos", "output vertical chroma position in luma grid/256" , OFFSET(out_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513}, -513, 512, FLAGS },
|
||||
{ "out_h_chr_pos", "output horizontal chroma position in luma grid/256", OFFSET(out_h_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513}, -513, 512, FLAGS },
|
||||
{ "in_v_chr_pos", "input vertical chroma position in luma grid/256" , OFFSET(in_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 512, FLAGS },
|
||||
{ "in_h_chr_pos", "input horizontal chroma position in luma grid/256", OFFSET(in_h_chr_pos), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 512, FLAGS },
|
||||
{ "out_v_chr_pos", "output vertical chroma position in luma grid/256" , OFFSET(out_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 512, FLAGS },
|
||||
{ "out_h_chr_pos", "output horizontal chroma position in luma grid/256", OFFSET(out_h_chr_pos), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 512, FLAGS },
|
||||
{ "force_original_aspect_ratio", "decrease or increase w/h if necessary to keep the original AR", OFFSET(force_original_aspect_ratio), AV_OPT_TYPE_INT, { .i64 = 0}, 0, 2, FLAGS, "force_oar" },
|
||||
{ "disable", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 0, FLAGS, "force_oar" },
|
||||
{ "decrease", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 0, FLAGS, "force_oar" },
|
||||
|
||||
@@ -55,10 +55,8 @@ static int ape_tag_read_field(AVFormatContext *s)
|
||||
av_log(s, AV_LOG_WARNING, "Invalid APE tag key '%s'.\n", key);
|
||||
return -1;
|
||||
}
|
||||
if (size > INT32_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
|
||||
av_log(s, AV_LOG_ERROR, "APE tag size too large.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (size >= UINT_MAX)
|
||||
return -1;
|
||||
if (flags & APE_TAG_FLAG_IS_BINARY) {
|
||||
uint8_t filename[1024];
|
||||
enum AVCodecID id;
|
||||
|
||||
@@ -916,7 +916,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 (60*12+6)
|
||||
struct {
|
||||
int64_t last_dts;
|
||||
int64_t duration_gcd;
|
||||
|
||||
@@ -1141,7 +1141,7 @@ start_sync:
|
||||
goto start_sync;
|
||||
}
|
||||
|
||||
n = get_stream_idx(d);
|
||||
n = avi->dv_demux ? 0 : get_stream_idx(d);
|
||||
|
||||
if (!((i - avi->last_pkt_pos) & 1) &&
|
||||
get_stream_idx(d + 1) < s->nb_streams)
|
||||
@@ -1153,9 +1153,6 @@ start_sync:
|
||||
goto start_sync;
|
||||
}
|
||||
|
||||
if (avi->dv_demux && n != 0)
|
||||
continue;
|
||||
|
||||
// parse ##dc/##wb
|
||||
if (n < s->nb_streams) {
|
||||
AVStream *st;
|
||||
|
||||
@@ -221,9 +221,6 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
|
||||
return offset1;
|
||||
offset += offset1;
|
||||
}
|
||||
if (offset < 0)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
offset1 = offset - pos;
|
||||
if (!s->must_flush && (!s->direct || !s->seek) &&
|
||||
offset1 >= 0 && offset1 <= buffer_size) {
|
||||
@@ -677,7 +674,7 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen)
|
||||
if (c && i < maxlen-1)
|
||||
buf[i++] = c;
|
||||
} while (c != '\n' && c != '\r' && c);
|
||||
if (c == '\r' && avio_r8(s) != '\n' && !avio_feof(s))
|
||||
if (c == '\r' && avio_r8(s) != '\n')
|
||||
avio_skip(s, -1);
|
||||
|
||||
buf[i] = 0;
|
||||
|
||||
@@ -127,8 +127,6 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
height = AV_RB16(&cdxl->header[16]);
|
||||
palette_size = AV_RB16(&cdxl->header[20]);
|
||||
audio_size = AV_RB16(&cdxl->header[22]);
|
||||
if (FFALIGN(width, 16) * (uint64_t)height * cdxl->header[19] > INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
image_size = FFALIGN(width, 16) * height * cdxl->header[19] / 8;
|
||||
video_size = palette_size + image_size;
|
||||
|
||||
|
||||
+1
-15
@@ -27,7 +27,6 @@
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavcodec/bmp.h"
|
||||
#include "libavutil/intfloat.h"
|
||||
#include "avformat.h"
|
||||
#include "internal.h"
|
||||
|
||||
@@ -79,16 +78,6 @@ static int set_metadata_int(AVDictionary **dict, const char *key, int value, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_metadata_float(AVDictionary **dict, const char *key, float value, int allow_zero)
|
||||
{
|
||||
if (value != 0 || allow_zero) {
|
||||
char tmp[64];
|
||||
snprintf(tmp, sizeof(tmp), "%f", value);
|
||||
return av_dict_set(dict, key, tmp, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cine_read_header(AVFormatContext *avctx)
|
||||
{
|
||||
AVIOContext *pb = avctx->pb;
|
||||
@@ -188,10 +177,7 @@ static int cine_read_header(AVFormatContext *avctx)
|
||||
set_metadata_int(&st->metadata, "contrast", avio_rl32(pb), 1);
|
||||
set_metadata_int(&st->metadata, "gamma", avio_rl32(pb), 1);
|
||||
|
||||
avio_skip(pb, 12 + 16); // Reserved1 .. AutoExpRect
|
||||
set_metadata_float(&st->metadata, "wbgain[0].r", av_int2float(avio_rl32(pb)), 1);
|
||||
set_metadata_float(&st->metadata, "wbgain[0].b", av_int2float(avio_rl32(pb)), 1);
|
||||
avio_skip(pb, 36); // WBGain[1].. WBView
|
||||
avio_skip(pb, 72); // Reserved1 .. WBView
|
||||
|
||||
st->codec->bits_per_coded_sample = avio_rl32(pb);
|
||||
|
||||
|
||||
+4
-19
@@ -34,7 +34,7 @@ static int dts_probe(AVProbeData *p)
|
||||
{
|
||||
const uint8_t *buf, *bufp;
|
||||
uint32_t state = -1;
|
||||
int markers[4*16] = {0};
|
||||
int markers[4] = {0};
|
||||
int sum, max, i;
|
||||
int64_t diff = 0;
|
||||
uint8_t hdr[12 + FF_INPUT_BUFFER_PADDING_SIZE] = { 0 };
|
||||
@@ -43,7 +43,6 @@ static int dts_probe(AVProbeData *p)
|
||||
|
||||
for(; buf < (p->buf+p->buf_size)-2; buf+=2) {
|
||||
int marker, sample_blocks, sample_rate, sr_code, framesize;
|
||||
int lfe;
|
||||
GetBitContext gb;
|
||||
|
||||
bufp = buf;
|
||||
@@ -90,27 +89,13 @@ static int dts_probe(AVProbeData *p)
|
||||
if (sample_rate == 0)
|
||||
continue;
|
||||
|
||||
get_bits(&gb, 5);
|
||||
if (get_bits(&gb, 1))
|
||||
continue;
|
||||
|
||||
skip_bits_long(&gb, 9);
|
||||
lfe = get_bits(&gb, 2);
|
||||
if (lfe > 2)
|
||||
continue;
|
||||
|
||||
marker += 4* sr_code;
|
||||
|
||||
markers[marker] ++;
|
||||
}
|
||||
|
||||
sum = max = 0;
|
||||
for (i=0; i<FF_ARRAY_ELEMS(markers); i++) {
|
||||
sum += markers[i];
|
||||
sum = markers[0] + markers[1] + markers[2] + markers[3];
|
||||
max = 0;
|
||||
for (i=1; i<4; i++)
|
||||
if (markers[max] < markers[i])
|
||||
max = i;
|
||||
}
|
||||
|
||||
if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 &&
|
||||
markers[max] * 4 > sum * 3 &&
|
||||
diff / p->buf_size > 200)
|
||||
|
||||
@@ -390,7 +390,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
|
||||
FLVContext *flv = s->priv_data;
|
||||
AVIOContext *ioc;
|
||||
AMFDataType amf_type;
|
||||
char str_val[1024];
|
||||
char str_val[256];
|
||||
double num_val;
|
||||
|
||||
num_val = 0;
|
||||
@@ -459,11 +459,11 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
|
||||
}
|
||||
|
||||
if (key) {
|
||||
acodec = astream ? astream->codec : NULL;
|
||||
vcodec = vstream ? vstream->codec : NULL;
|
||||
|
||||
// stream info doesn't live any deeper than the first object
|
||||
if (depth == 1) {
|
||||
acodec = astream ? astream->codec : NULL;
|
||||
vcodec = vstream ? vstream->codec : NULL;
|
||||
|
||||
if (amf_type == AMF_DATA_TYPE_NUMBER ||
|
||||
amf_type == AMF_DATA_TYPE_BOOL) {
|
||||
if (!strcmp(key, "duration"))
|
||||
@@ -558,13 +558,13 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos)
|
||||
type = avio_r8(ioc);
|
||||
if (type != AMF_DATA_TYPE_STRING ||
|
||||
amf_get_string(ioc, buffer, sizeof(buffer)) < 0)
|
||||
return 2;
|
||||
return -1;
|
||||
|
||||
if (!strcmp(buffer, "onTextData"))
|
||||
return 1;
|
||||
|
||||
if (strcmp(buffer, "onMetaData") && strcmp(buffer, "onCuePoint"))
|
||||
return 2;
|
||||
return -1;
|
||||
|
||||
// find the streams now so that amf_parse_object doesn't need to do
|
||||
// the lookup every time it is called.
|
||||
@@ -623,7 +623,7 @@ static int flv_read_close(AVFormatContext *s)
|
||||
|
||||
static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size)
|
||||
{
|
||||
av_freep(&st->codec->extradata);
|
||||
av_free(st->codec->extradata);
|
||||
if (ff_get_extradata(st->codec, s->pb, size) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
return 0;
|
||||
@@ -822,7 +822,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
stream_type=FLV_STREAM_TYPE_DATA;
|
||||
if (size > 13 + 1 + 4 && dts == 0) { // Header-type metadata stuff
|
||||
meta_pos = avio_tell(s->pb);
|
||||
if (flv_read_metabody(s, next) <= 0) {
|
||||
if (flv_read_metabody(s, next) == 0) {
|
||||
goto skip;
|
||||
}
|
||||
avio_seek(s->pb, meta_pos, SEEK_SET);
|
||||
|
||||
@@ -145,15 +145,15 @@ static void hds_free(AVFormatContext *s)
|
||||
if (os->ctx && os->ctx_inited)
|
||||
av_write_trailer(os->ctx);
|
||||
if (os->ctx && os->ctx->pb)
|
||||
av_freep(&os->ctx->pb);
|
||||
av_free(os->ctx->pb);
|
||||
if (os->ctx)
|
||||
avformat_free_context(os->ctx);
|
||||
av_freep(&os->metadata);
|
||||
av_free(os->metadata);
|
||||
for (j = 0; j < os->nb_extra_packets; j++)
|
||||
av_freep(&os->extra_packets[j]);
|
||||
av_free(os->extra_packets[j]);
|
||||
for (j = 0; j < os->nb_fragments; j++)
|
||||
av_freep(&os->fragments[j]);
|
||||
av_freep(&os->fragments);
|
||||
av_free(os->fragments[j]);
|
||||
av_free(os->fragments);
|
||||
}
|
||||
av_freep(&c->streams);
|
||||
}
|
||||
@@ -506,7 +506,7 @@ static int hds_flush(AVFormatContext *s, OutputStream *os, int final,
|
||||
if (remove > 0) {
|
||||
for (i = 0; i < remove; i++) {
|
||||
unlink(os->fragments[i]->file);
|
||||
av_freep(&os->fragments[i]);
|
||||
av_free(os->fragments[i]);
|
||||
}
|
||||
os->nb_fragments -= remove;
|
||||
memmove(os->fragments, os->fragments + remove,
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <float.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "libavutil/parseutils.h"
|
||||
#include "libavutil/avstring.h"
|
||||
@@ -252,12 +251,6 @@ static int hls_write_header(AVFormatContext *s)
|
||||
if ((ret = avformat_write_header(hls->avf, NULL)) < 0)
|
||||
goto fail;
|
||||
|
||||
av_assert0(s->nb_streams == hls->avf->nb_streams);
|
||||
for (i = 0; i < s->nb_streams; i++) {
|
||||
AVStream *inner_st = hls->avf->streams[i];
|
||||
AVStream *outter_st = s->streams[i];
|
||||
avpriv_set_pts_info(outter_st, inner_st->pts_wrap_bits, inner_st->time_base.num, inner_st->time_base.den);
|
||||
}
|
||||
|
||||
fail:
|
||||
if (ret) {
|
||||
@@ -329,10 +322,9 @@ static int hls_write_trailer(struct AVFormatContext *s)
|
||||
|
||||
av_write_trailer(oc);
|
||||
avio_closep(&oc->pb);
|
||||
avformat_free_context(oc);
|
||||
av_free(hls->basename);
|
||||
hls_append_segment(hls, hls->duration);
|
||||
avformat_free_context(oc);
|
||||
hls->avf = NULL;
|
||||
hls_window(s, 1);
|
||||
|
||||
hls_free_segments(hls);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user