summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog1
-rw-r--r--cmdutils.c2
-rw-r--r--cmdutils.h2
-rw-r--r--doc/APIchanges294
-rw-r--r--doc/general.texi2
-rw-r--r--libavcodec/Makefile1
-rw-r--r--libavcodec/aacdec.c2
-rw-r--r--libavcodec/allcodecs.c1
-rw-r--r--libavcodec/avcodec.h1
-rw-r--r--libavcodec/bytestream.h30
-rw-r--r--libavcodec/proresenc_kostya.c114
-rw-r--r--libavcodec/version.h2
-rw-r--r--libavcodec/vqavideo.c201
-rw-r--r--libavcodec/xbmenc.c86
-rw-r--r--libavcodec/xwddec.c66
-rw-r--r--libavformat/img2.c1
-rw-r--r--libavformat/img2enc.c2
-rw-r--r--libavformat/utils.c44
-rwxr-xr-xtests/fate-run.sh3
-rw-r--r--tests/ref/fate/vqa-cc1
20 files changed, 464 insertions, 392 deletions
diff --git a/Changelog b/Changelog
index 8c7eb1be60..cfcaf6b5a9 100644
--- a/Changelog
+++ b/Changelog
@@ -15,6 +15,7 @@ version next:
- libutvideo encoder wrapper (--enable-libutvideo)
- swapuv filter
- bbox filter
+- XBM encoder
version 0.10:
diff --git a/cmdutils.c b/cmdutils.c
index 02113518ee..58f08f6b3b 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -1064,7 +1064,7 @@ FILE *get_preset_file(char *filename, size_t filename_size,
if (!f && codec_name) {
snprintf(filename, filename_size,
"%s%s/%s-%s.ffpreset",
- base[i], i != 1 ? "" : "/.ffmpeg", codec_name,
+ base[i], i != 1 ? "" : "/.ffmpeg", codec_name,
preset_name);
f = fopen(filename, "r");
}
diff --git a/cmdutils.h b/cmdutils.h
index 26cd96a131..ad74213027 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -357,7 +357,7 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size);
* at configuration time or in a "ffpresets" folder along the executable
* on win32, in that order. If no such file is found and
* codec_name is defined, then search for a file named
- * codec_name-preset_name.ffpreset in the above-mentioned directories.
+ * codec_name-preset_name.avpreset in the above-mentioned directories.
*
* @param filename buffer where the name of the found filename is written
* @param filename_size size in bytes of the filename buffer
diff --git a/doc/APIchanges b/doc/APIchanges
index cd9349569d..26a3882243 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -605,39 +605,39 @@ API changes, most recent first:
2011-01-31 - 910b5b8 - lavfi 1.75.0 - AVFilterLink sample_aspect_ratio
Add sample_aspect_ratio field to AVFilterLink.
-2011-01-15 - r26374 - lavfi 1.74.0 - AVFilterBufferRefAudioProps
+2011-01-15 - a242ac3 - lavfi 1.74.0 - AVFilterBufferRefAudioProps
Rename AVFilterBufferRefAudioProps.samples_nb to nb_samples.
-2011-01-14 - r26330 - lavf 52.93.0 - av_metadata_copy()
+2011-01-14 - 7f88a5b - lavf 52.93.0 - av_metadata_copy()
Add av_metadata_copy() in avformat.h.
-2011-01-07 - r26262 - lavc 52.107.0 - deprecate reordered_opaque
+2011-01-07 - 81c623f - lavc 52.107.0 - deprecate reordered_opaque
Deprecate reordered_opaque in favor of pkt_pts/dts.
-2011-01-07 - r26261 - lavc 52.106.0 - pkt_dts
+2011-01-07 - 1919fea - lavc 52.106.0 - pkt_dts
Add pkt_dts to AVFrame, this will in the future allow multithreading decoders
to not mess up dts.
-2011-01-07 - r26260 - lavc 52.105.0 - pkt_pts
+2011-01-07 - 393cbb9 - lavc 52.105.0 - pkt_pts
Add pkt_pts to AVFrame.
-2011-01-07 - r26259 - lavc 52.104.0 - av_get_profile_name()
+2011-01-07 - 060ec0a - lavc 52.104.0 - av_get_profile_name()
Add av_get_profile_name to libavcodec/avcodec.h.
-2010-12-27 - r26108 - lavfi 1.71.0 - AV_PERM_NEG_LINESIZES
+2010-12-27 - 0ccabee - lavfi 1.71.0 - AV_PERM_NEG_LINESIZES
Add AV_PERM_NEG_LINESIZES in avfilter.h.
-2010-12-27 - r26104 - lavf 52.91.0 - av_find_best_stream()
+2010-12-27 - 9128ae0 - lavf 52.91.0 - av_find_best_stream()
Add av_find_best_stream to libavformat/avformat.h.
-2010-12-27 - r26103 - lavf 52.90.0
+2010-12-27 - 107a7e3 - lavf 52.90.0
Add AVFMT_NOSTREAMS flag for formats with no streams,
like e.g. text metadata.
-2010-12-22 - r26073 - lavu 50.36.0 - file.h
+2010-12-22 - 0328b9e - lavu 50.36.0 - file.h
Add functions av_file_map() and av_file_unmap() in file.h.
-2010-12-19 - r26056 - lavu 50.35.0 - error.h
+2010-12-19 - 0bc55f5 - lavu 50.35.0 - error.h
Add "not found" error codes:
AVERROR_DEMUXER_NOT_FOUND
AVERROR_MUXER_NOT_FOUND
@@ -648,28 +648,28 @@ API changes, most recent first:
AVERROR_BSF_NOT_FOUND
AVERROR_STREAM_NOT_FOUND
-2010-12-09 - r25923 - lavcore 0.16.0 - avcore.h
+2010-12-09 - c61cdd0 - lavcore 0.16.0 - avcore.h
Move AV_NOPTS_VALUE, AV_TIME_BASE, AV_TIME_BASE_Q symbols from
avcodec.h to avcore.h.
-2010-12-04 - r25886 - lavc 52.98.0 - CODEC_CAP_NEG_LINESIZES
+2010-12-04 - 16cfc96 - lavc 52.98.0 - CODEC_CAP_NEG_LINESIZES
Add CODEC_CAP_NEG_LINESIZES codec capability flag in avcodec.h.
-2010-12-04 - r25879 - lavu 50.34.0 - av_get_pix_fmt_string()
+2010-12-04 - bb4afa1 - lavu 50.34.0 - av_get_pix_fmt_string()
Deprecate avcodec_pix_fmt_string() in favor of
pixdesc.h/av_get_pix_fmt_string().
-2010-12-04 - r25878 - lavcore 0.15.0 - av_image_alloc()
+2010-12-04 - 4da12e3 - lavcore 0.15.0 - av_image_alloc()
Add av_image_alloc() to libavcore/imgutils.h.
-2010-12-02 - r25862 - lavfi 1.67.0 - avfilter_graph_create_filter()
+2010-12-02 - 037be76 - lavfi 1.67.0 - avfilter_graph_create_filter()
Add function avfilter_graph_create_filter() in avfiltergraph.h.
-2010-11-25 - r25826 - lavfi 1.65.0 - avfilter_get_video_buffer_ref_from_arrays()
+2010-11-25 - 4723bc2 - lavfi 1.65.0 - avfilter_get_video_buffer_ref_from_arrays()
Add function avfilter_get_video_buffer_ref_from_arrays() in
avfilter.h.
-2010-11-21 - r25787 - lavcore 0.14.0 - audioconvert.h
+2010-11-21 - 176a615 - lavcore 0.14.0 - audioconvert.h
Add a public audio channel API in audioconvert.h, and deprecate the
corresponding functions in libavcodec:
avcodec_get_channel_name()
@@ -678,23 +678,23 @@ API changes, most recent first:
avcodec_channel_layout_num_channels()
and the CH_* macros defined in libavcodec/avcodec.h.
-2010-11-21 - r25777 - lavf 52.85.0 - avformat.h
+2010-11-21 - 6bfc268 - lavf 52.85.0 - avformat.h
Add av_append_packet().
-2010-11-21 - r25776 - lavc 52.97.0 - avcodec.h
+2010-11-21 - a08d918 - lavc 52.97.0 - avcodec.h
Add av_grow_packet().
-2010-11-17 - r25761 - lavcore 0.13.0 - parseutils.h
+2010-11-17 - 0985e1a - lavcore 0.13.0 - parseutils.h
Add av_parse_color() declared in libavcore/parseutils.h.
-2010-11-13 - r25745 - lavc 52.95.0 - AVCodecContext
+2010-11-13 - cb2c971 - lavc 52.95.0 - AVCodecContext
Add AVCodecContext.subtitle_header and AVCodecContext.subtitle_header_size
fields.
-2010-11-13 - r25740 - lavfi 1.62.0 - avfiltergraph.h
+2010-11-13 - 5aaea02 - lavfi 1.62.0 - avfiltergraph.h
Make avfiltergraph.h public.
-2010-11-13 - r25737 - lavfi 1.61.0 - avfiltergraph.h
+2010-11-13 - 4fcbb2a - lavfi 1.61.0 - avfiltergraph.h
Remove declarations from avfiltergraph.h for the functions:
avfilter_graph_check_validity()
avfilter_graph_config_links()
@@ -702,7 +702,7 @@ API changes, most recent first:
which are now internal.
Use avfilter_graph_config() instead.
-2010-11-08 - r25708 - lavu 50.33.0 - eval.h
+2010-11-08 - d2af720 - lavu 50.33.0 - eval.h
Deprecate functions:
av_parse_and_eval_expr(),
av_parse_expr(),
@@ -714,30 +714,30 @@ API changes, most recent first:
av_expr_eval(),
av_expr_free().
-2010-11-08 - r25707 - lavfi 1.59.0 - avfilter_free()
+2010-11-08 - 24de0ed - lavfi 1.59.0 - avfilter_free()
Rename avfilter_destroy() to avfilter_free().
This change breaks libavfilter API/ABI.
-2010-11-07 - r25705 - lavfi 1.58.0 - avfiltergraph.h
+2010-11-07 - 1e80a0e - lavfi 1.58.0 - avfiltergraph.h
Remove graphparser.h header, move AVFilterInOut and
avfilter_graph_parse() declarations to libavfilter/avfiltergraph.h.
-2010-11-07 - r25700 - lavfi 1.57.0 - AVFilterInOut
+2010-11-07 - 7313132 - lavfi 1.57.0 - AVFilterInOut
Rename field AVFilterInOut.filter to AVFilterInOut.filter_ctx.
This change breaks libavfilter API.
-2010-11-04 - r25674 - lavfi 1.56.0 - avfilter_graph_free()
+2010-11-04 - 97dd1e4 - lavfi 1.56.0 - avfilter_graph_free()
Rename avfilter_graph_destroy() to avfilter_graph_free().
This change breaks libavfilter API/ABI.
-2010-11-04 - r25673 - lavfi 1.55.0 - avfilter_graph_alloc()
+2010-11-04 - e15aeea - lavfi 1.55.0 - avfilter_graph_alloc()
Add avfilter_graph_alloc() to libavfilter/avfiltergraph.h.
-2010-11-02 - r25654 - lavcore 0.12.0 - av_get_bits_per_sample_fmt()
+2010-11-02 - 6f84cd1 - lavcore 0.12.0 - av_get_bits_per_sample_fmt()
Add av_get_bits_per_sample_fmt() to libavcore/samplefmt.h and
deprecate av_get_bits_per_sample_format().
-2010-11-02 - r25653 - lavcore 0.11.0 - samplefmt.h
+2010-11-02 - d63e456 - lavcore 0.11.0 - samplefmt.h
Add sample format functions in libavcore/samplefmt.h:
av_get_sample_fmt_name(),
av_get_sample_fmt(),
@@ -747,149 +747,149 @@ API changes, most recent first:
avcodec_get_sample_fmt(),
avcodec_sample_fmt_string().
-2010-11-02 - r25652 - lavcore 0.10.0 - samplefmt.h
+2010-11-02 - 262d1c5 - lavcore 0.10.0 - samplefmt.h
Define enum AVSampleFormat in libavcore/samplefmt.h, deprecate enum
SampleFormat.
-2010-10-16 - r25502 - lavfi 1.52.0 - avfilter_graph_config()
+2010-10-16 - 2a24df9 - lavfi 1.52.0 - avfilter_graph_config()
Add the function avfilter_graph_config() in avfiltergraph.h.
-2010-10-15 - r25493 - lavf 52.83.0 - metadata API
+2010-10-15 - 03700d3 - lavf 52.83.0 - metadata API
Change demuxers to export metadata in generic format and
muxers to accept generic format. Deprecate the public
conversion API.
-2010-10-10 - r25441 - lavfi 1.49.0 - AVFilterLink.time_base
+2010-10-10 - 867ae7a - lavfi 1.49.0 - AVFilterLink.time_base
Add time_base field to AVFilterLink.
-2010-09-27 - r25236 - lavu 50.31.0 - av_set_options_string()
+2010-09-27 - c85eef4 - lavu 50.31.0 - av_set_options_string()
Move av_set_options_string() from libavfilter/parseutils.h to
libavutil/opt.h.
-2010-09-27 - r25227 - lavfi 1.47.0 - AVFilterLink
+2010-09-27 - acc0490 - lavfi 1.47.0 - AVFilterLink
Make the AVFilterLink fields srcpad and dstpad store the pointers to
the source and destination pads, rather than their indexes.
-2010-09-27 - r25225 - lavu 50.30.0 - av_get_token()
+2010-09-27 - 372e288 - lavu 50.30.0 - av_get_token()
Move av_get_token() from libavfilter/parseutils.h to
libavutil/avstring.h.
-2010-09-26 - r32368 - lsws 0.12.0 - swscale.h
+2010-09-26 - 635d4ae - lsws 0.12.0 - swscale.h
Add the functions sws_alloc_context() and sws_init_context().
-2010-09-26 - r25210 - lavu 50.29.0 - opt.h
+2010-09-26 - 6ed0404 - lavu 50.29.0 - opt.h
Move libavcodec/opt.h to libavutil/opt.h.
-2010-09-24 - r25174 - lavu 50.28.0 - av_log_set_flags()
+2010-09-24 - 1c1c80f - lavu 50.28.0 - av_log_set_flags()
Default of av_log() changed due to many problems to the old no repeat
detection. Read the docs of AV_LOG_SKIP_REPEATED in log.h before
enabling it for your app!.
-2010-09-24 - r25167 - lavc 52.90.0 - av_opt_show2()
+2010-09-24 - f66eb58 - lavc 52.90.0 - av_opt_show2()
Deprecate av_opt_show() in favor or av_opt_show2().
-2010-09-14 - r25120 - lavu 50.27.0 - av_popcount()
+2010-09-14 - bc6f0af - lavu 50.27.0 - av_popcount()
Add av_popcount() to libavutil/common.h.
-2010-09-08 - r25076 - lavu 50.26.0 - av_get_cpu_flags()
+2010-09-08 - c6c98d0 - lavu 50.26.0 - av_get_cpu_flags()
Add av_get_cpu_flags().
-2010-09-07 - r25067 - lavcore 0.9.0 - av_image_copy()
+2010-09-07 - 34017fd - lavcore 0.9.0 - av_image_copy()
Add av_image_copy().
-2010-09-07 - r25064 - lavcore 0.8.0 - av_image_copy_plane()
+2010-09-07 - 9686abb - lavcore 0.8.0 - av_image_copy_plane()
Add av_image_copy_plane().
-2010-09-07 - r25057 - lavcore 0.7.0 - imgutils.h
+2010-09-07 - 9b7269e - lavcore 0.7.0 - imgutils.h
Adopt hierarchical scheme for the imgutils.h function names,
deprecate the old names.
-2010-09-04 - r25040 - lavu 50.25.0 - AV_CPU_FLAG_*
+2010-09-04 - 7160bb7 - lavu 50.25.0 - AV_CPU_FLAG_*
Deprecate the FF_MM_* flags defined in libavcodec/avcodec.h in favor
of the AV_CPU_FLAG_* flags defined in libavutil/cpu.h.
-2010-08-26 - r24936 - lavc 52.87.0 - avcodec_get_channel_layout()
+2010-08-26 - 5da19b5 - lavc 52.87.0 - avcodec_get_channel_layout()
Add avcodec_get_channel_layout() in audioconvert.h.
-2010-08-20 - r24851 - lavcore 0.6.0 - av_fill_image_max_pixsteps()
+2010-08-20 - e344336 - lavcore 0.6.0 - av_fill_image_max_pixsteps()
Rename av_fill_image_max_pixstep() to av_fill_image_max_pixsteps().
-2010-08-18 - r24827 - lavcore 0.5.0 - av_fill_image_max_pixstep()
+2010-08-18 - a6ddf8b - lavcore 0.5.0 - av_fill_image_max_pixstep()
Add av_fill_image_max_pixstep() in imgutils.h.
-2010-08-17 - r24814 - lavu 50.24.0 - AV_NE()
+2010-08-17 - 4f2d2e4 - lavu 50.24.0 - AV_NE()
Add the AV_NE macro.
-2010-08-17 - r24811 - lavfi 1.36.0 - audio framework
+2010-08-17 - ad2c950 - lavfi 1.36.0 - audio framework
Implement AVFilterBufferRefAudioProps struct for audio properties,
get_audio_buffer(), filter_samples() functions and related changes.
-2010-08-12 - r24787 - lavcore 0.4.0 - av_get_image_linesize()
+2010-08-12 - 81c1eca - lavcore 0.4.0 - av_get_image_linesize()
Add av_get_image_linesize() in imgutils.h.
-2010-08-11 - r24773 - lavfi 1.34.0 - AVFilterBufferRef
+2010-08-11 - c1db7bf - lavfi 1.34.0 - AVFilterBufferRef
Resize data and linesize arrays in AVFilterBufferRef to 8.
This change breaks libavfilter API/ABI.
-2010-08-11 - r24768 - lavc 52.85.0 - av_picture_data_copy()
+2010-08-11 - 9f08d80 - lavc 52.85.0 - av_picture_data_copy()
Add av_picture_data_copy in avcodec.h.
-2010-08-11 - r24765 - lavfi 1.33.0 - avfilter_open()
+2010-08-11 - 84c0386 - lavfi 1.33.0 - avfilter_open()
Change avfilter_open() signature:
AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name) ->
int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name);
This change breaks libavfilter API/ABI.
-2010-08-11 - r24763 - lavfi 1.32.0 - AVFilterBufferRef
+2010-08-11 - cc80caf - lavfi 1.32.0 - AVFilterBufferRef
Add a type field to AVFilterBufferRef, and move video specific
properties to AVFilterBufferRefVideoProps.
This change breaks libavfilter API/ABI.
-2010-08-07 - r24732 - lavfi 1.31.0 - AVFilterLink
+2010-08-07 - 5d4890d - lavfi 1.31.0 - AVFilterLink
Rename AVFilterLink fields:
AVFilterLink.srcpic -> AVFilterLink.src_buf
AVFilterLink.cur_pic -> AVFilterLink.cur_buf
AVFilterLink.outpic -> AVFilterLink.out_buf
-2010-08-07 - r24731 - lavfi 1.30.0
+2010-08-07 - 7fce481 - lavfi 1.30.0
Rename functions and fields:
avfilter_(un)ref_pic -> avfilter_(un)ref_buffer
avfilter_copy_picref_props -> avfilter_copy_buffer_ref_props
AVFilterBufferRef.pic -> AVFilterBufferRef.buffer
-2010-08-07 - r24730 - lavfi 1.29.0 - AVFilterBufferRef
+2010-08-07 - ecc8dad - lavfi 1.29.0 - AVFilterBufferRef
Rename AVFilterPicRef to AVFilterBufferRef.
-2010-08-07 - r24728 - lavfi 1.28.0 - AVFilterBuffer
+2010-08-07 - d54e094 - lavfi 1.28.0 - AVFilterBuffer
Move format field from AVFilterBuffer to AVFilterPicRef.
-2010-08-06 - r24709 - lavcore 0.3.0 - av_check_image_size()
+2010-08-06 - bf176f5 - lavcore 0.3.0 - av_check_image_size()
Deprecate avcodec_check_dimensions() in favor of the function
av_check_image_size() defined in libavcore/imgutils.h.
-2010-07-30 - r24592 - lavfi 1.27.0 - AVFilterBuffer
+2010-07-30 - 56b5e9d - lavfi 1.27.0 - AVFilterBuffer
Increase size of the arrays AVFilterBuffer.data and
AVFilterBuffer.linesize from 4 to 8.
This change breaks libavfilter ABI.
-2010-07-29 - r24583 - lavcore 0.2.0 - imgutils.h
+2010-07-29 - e7bd48a - lavcore 0.2.0 - imgutils.h
Add functions av_fill_image_linesizes() and
av_fill_image_pointers(), declared in libavcore/imgutils.h.
-2010-07-27 - r24518 - lavcore 0.1.0 - parseutils.h
+2010-07-27 - 126b638 - lavcore 0.1.0 - parseutils.h
Deprecate av_parse_video_frame_size() and av_parse_video_frame_rate()
defined in libavcodec in favor of the newly added functions
av_parse_video_size() and av_parse_video_rate() declared in
libavcore/parseutils.h.
-2010-07-23 - r24439 - lavu 50.23.0 - mathematics.h
+2010-07-23 - 4485247 - lavu 50.23.0 - mathematics.h
Add the M_PHI constant definition.
-2010-07-22 - r24424 - lavfi 1.26.0 - media format generalization
+2010-07-22 - bdab614 - lavfi 1.26.0 - media format generalization
Add a type field to AVFilterLink.
Change the field types:
@@ -909,235 +909,235 @@ API changes, most recent first:
This change breaks libavfilter API/ABI.
-2010-07-21 - r24393 - lavcore 0.0.0
+2010-07-21 - aac6ca6 - lavcore 0.0.0
Add libavcore.
-2010-07-17 - r24291 - lavfi 1.25.0 - AVFilterBuffer
+2010-07-17 - b5c582f - lavfi 1.25.0 - AVFilterBuffer
Remove w and h fields from AVFilterBuffer.
-2010-07-17 - r24284 - lavfi 1.24.0 - AVFilterBuffer
+2010-07-17 - f0d77b2 - lavfi 1.24.0 - AVFilterBuffer
Rename AVFilterPic to AVFilterBuffer.
-2010-07-17 - r24278 - lavf 52.74.0 - url_fskip()
+2010-07-17 - 57fe80f - lavf 52.74.0 - url_fskip()
Make url_fskip() return an int error code instead of void.
-2010-07-11 - r24199 - lavc 52.83.0
+2010-07-11 - 23940f1 - lavc 52.83.0
Add AVCodecContext.lpc_type and AVCodecContext.lpc_passes fields.
Add AVLPCType enum.
Deprecate AVCodecContext.use_lpc.
-2010-07-11 - r24185 - lavc 52.82.0 - avsubtitle_free()
+2010-07-11 - e1d7c88 - lavc 52.82.0 - avsubtitle_free()
Add a function for free the contents of a AVSubtitle generated by
avcodec_decode_subtitle.
-2010-07-11 - r24174 - lavu 50.22.0 - bswap.h and intreadwrite.h
+2010-07-11 - b91d08f - lavu 50.22.0 - bswap.h and intreadwrite.h
Make the bswap.h and intreadwrite.h API public.
-2010-07-08 - r24101 - lavu 50.21.0 - pixdesc.h
+2010-07-08 - ce1cd1c - lavu 50.21.0 - pixdesc.h
Rename read/write_line() to av_read/write_image_line().
-2010-07-07 - r24091 - lavfi 1.21.0 - avfilter_copy_picref_props()
+2010-07-07 - 4d508e4 - lavfi 1.21.0 - avfilter_copy_picref_props()
Add avfilter_copy_picref_props().
-2010-07-03 - r24021 - lavc 52.79.0
+2010-07-03 - 2d525ef - lavc 52.79.0
Add FF_COMPLIANCE_UNOFFICIAL and change all instances of
FF_COMPLIANCE_INOFFICIAL to use FF_COMPLIANCE_UNOFFICIAL.
-2010-07-02 - r23985 - lavu 50.20.0 - lfg.h
+2010-07-02 - 89eec74 - lavu 50.20.0 - lfg.h
Export av_lfg_init(), av_lfg_get(), av_mlfg_get(), and av_bmg_get() through
lfg.h.
-2010-06-28 - r23835 - lavfi 1.20.1 - av_parse_color()
+2010-06-28 - a52e2c3 - lavfi 1.20.1 - av_parse_color()
Extend av_parse_color() syntax, make it accept an alpha value specifier and
set the alpha value to 255 by default.
-2010-06-22 - r23706 - lavf 52.71.0 - URLProtocol.priv_data_size, priv_data_class
+2010-06-22 - 735cf6b - lavf 52.71.0 - URLProtocol.priv_data_size, priv_data_class
Add priv_data_size and priv_data_class to URLProtocol.
-2010-06-22 - r23704 - lavf 52.70.0 - url_alloc(), url_connect()
+2010-06-22 - ffbb289 - lavf 52.70.0 - url_alloc(), url_connect()
Add url_alloc() and url_connect().
-2010-06-22 - r23702 - lavf 52.69.0 - av_register_protocol2()
+2010-06-22 - 9b07a2d - lavf 52.69.0 - av_register_protocol2()
Add av_register_protocol2(), deprecating av_register_protocol().
-2010-06-09 - r23551 - lavu 50.19.0 - av_compare_mod()
+2010-06-09 - 65db058 - lavu 50.19.0 - av_compare_mod()
Add av_compare_mod() to libavutil/mathematics.h.
-2010-06-05 - r23485 - lavu 50.18.0 - eval API
+2010-06-05 - 0b99215 - lavu 50.18.0 - eval API
Make the eval API public.
-2010-06-04 - r23461 - lavu 50.17.0 - AV_BASE64_SIZE
+2010-06-04 - 31878fc - lavu 50.17.0 - AV_BASE64_SIZE
Add AV_BASE64_SIZE() macro.
-2010-06-02 - r23421 - lavc 52.73.0 - av_get_codec_tag_string()
+2010-06-02 - 7e566bb - lavc 52.73.0 - av_get_codec_tag_string()
Add av_get_codec_tag_string().
-2010-06-01 - r31301 - lsws 0.11.0 - convertPalette API
+2010-06-01 - 2b99142 - lsws 0.11.0 - convertPalette API
Add sws_convertPalette8ToPacked32() and sws_convertPalette8ToPacked24().
-2010-05-26 - r23334 - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL
+2010-05-26 - 93ebfee - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL
Add CODEC_CAP_EXPERIMENTAL flag.
NOTE: this was backported to 0.6
-2010-05-23 - r23255 - lavu 50.16.0 - av_get_random_seed()
+2010-05-23 - 9977863 - lavu 50.16.0 - av_get_random_seed()
Add av_get_random_seed().
-2010-05-18 - r23161 - lavf 52.63.0 - AVFMT_FLAG_RTP_HINT
+2010-05-18 - 796ac23 - lavf 52.63.0 - AVFMT_FLAG_RTP_HINT
Add AVFMT_FLAG_RTP_HINT as possible value for AVFormatContext.flags.
NOTE: this was backported to 0.6
-2010-05-09 - r23066 - lavfi 1.20.0 - AVFilterPicRef
+2010-05-09 - b6bc205 - lavfi 1.20.0 - AVFilterPicRef
Add interlaced and top_field_first fields to AVFilterPicRef.
------------------------------8<-------------------------------------
0.6 branch was cut here
----------------------------->8--------------------------------------
-2010-05-01 - r23002 - lavf 52.62.0 - probe function
+2010-05-01 - 8e2ee18 - lavf 52.62.0 - probe function
Add av_probe_input_format2 to API, it allows ignoring probe
results below given score and returns the actual probe score.
-2010-04-01 - r22806 - lavf 52.61.0 - metadata API
+2010-04-01 - 3dd6180 - lavf 52.61.0 - metadata API
Add a flag for av_metadata_set2() to disable overwriting of
existing tags.
-2010-04-01 - r22753 - lavc 52.66.0
+2010-04-01 - 0fb49b5 - lavc 52.66.0
Add avcodec_get_edge_width().
-2010-03-31 - r22750 - lavc 52.65.0
+2010-03-31 - d103218 - lavc 52.65.0
Add avcodec_copy_context().
-2010-03-31 - r22748 - lavf 52.60.0 - av_match_ext()
+2010-03-31 - 1a70d12 - lavf 52.60.0 - av_match_ext()
Make av_match_ext() public.
-2010-03-31 - r22736 - lavu 50.14.0 - AVMediaType
+2010-03-31 - 1149150 - lavu 50.14.0 - AVMediaType
Move AVMediaType enum from libavcodec to libavutil.
-2010-03-31 - r22735 - lavc 52.64.0 - AVMediaType
+2010-03-31 - 72415b2 - lavc 52.64.0 - AVMediaType
Define AVMediaType enum, and use it instead of enum CodecType, which
is deprecated and will be dropped at the next major bump.
-2010-03-25 - r22684 - lavu 50.13.0 - av_strerror()
+2010-03-25 - 8795823 - lavu 50.13.0 - av_strerror()
Implement av_strerror().
-2010-03-23 - r22649 - lavc 52.60.0 - av_dct_init()
+2010-03-23 - e1484eb - lavc 52.60.0 - av_dct_init()
Support DCT-I and DST-I.
-2010-03-15 - r22540 - lavf 52.56.0 - AVFormatContext.start_time_realtime
+2010-03-15 - b8819c8 - lavf 52.56.0 - AVFormatContext.start_time_realtime
Add AVFormatContext.start_time_realtime field.
-2010-03-13 - r22506 - lavfi 1.18.0 - AVFilterPicRef.pos
+2010-03-13 - 5bb5c1d - lavfi 1.18.0 - AVFilterPicRef.pos
Add AVFilterPicRef.pos field.
-2010-03-13 - r22501 - lavu 50.12.0 - error.h
+2010-03-13 - 60c144f - lavu 50.12.0 - error.h
Move error code definitions from libavcodec/avcodec.h to
the new public header libavutil/error.h.
-2010-03-07 - r22291 - lavc 52.56.0 - avfft.h
+2010-03-07 - c709483 - lavc 52.56.0 - avfft.h
Add public FFT interface.
-2010-03-06 - r22251 - lavu 50.11.0 - av_stristr()
+2010-03-06 - ac6ef86 - lavu 50.11.0 - av_stristr()
Add av_stristr().
-2010-03-03 - r22174 - lavu 50.10.0 - av_tree_enumerate()
+2010-03-03 - 4b83fc0 - lavu 50.10.0 - av_tree_enumerate()
Add av_tree_enumerate().
-2010-02-07 - r21673 - lavu 50.9.0 - av_compare_ts()
+2010-02-07 - b687c1a - lavu 50.9.0 - av_compare_ts()
Add av_compare_ts().
-2010-02-05 - r30513 - lsws 0.10.0 - sws_getCoefficients()
+2010-02-05 - 3f3dc76 - lsws 0.10.0 - sws_getCoefficients()
Add sws_getCoefficients().
-2010-02-01 - r21587 - lavf 52.50.0 - metadata API
+2010-02-01 - ca76a11 - lavf 52.50.0 - metadata API
Add a list of generic tag names, change 'author' -> 'artist',
'year' -> 'date'.
-2010-01-30 - r21545 - lavu 50.8.0 - av_get_pix_fmt()
+2010-01-30 - 80a07f6 - lavu 50.8.0 - av_get_pix_fmt()
Add av_get_pix_fmt().
-2010-01-21 - r30381 - lsws 0.9.0 - sws_scale()
+2010-01-21 - 01cc47d - lsws 0.9.0 - sws_scale()
Change constness attributes of sws_scale() parameters.
-2010-01-10 - r21121 - lavfi 1.15.0 - avfilter_graph_config_links()
+2010-01-10 - 3fb8e77 - lavfi 1.15.0 - avfilter_graph_config_links()
Add a log_ctx parameter to avfilter_graph_config_links().
-2010-01-07 - r30236 - lsws 0.8.0 - sws_isSupported{In,Out}put()
+2010-01-07 - 8e9767f - lsws 0.8.0 - sws_isSupported{In,Out}put()
Add sws_isSupportedInput() and sws_isSupportedOutput() functions.
-2010-01-06 - r21035 - lavfi 1.14.0 - avfilter_add_colorspace()
+2010-01-06 - c1d662f - lavfi 1.14.0 - avfilter_add_colorspace()
Change the avfilter_add_colorspace() signature, make it accept an
(AVFilterFormats **) rather than an (AVFilterFormats *) as before.
-2010-01-03 - r21007 - lavfi 1.13.0 - avfilter_add_colorspace()
+2010-01-03 - 4fd1f18 - lavfi 1.13.0 - avfilter_add_colorspace()
Add avfilter_add_colorspace().
-2010-01-02 - r20998 - lavf 52.46.0 - av_match_ext()
+2010-01-02 - 8eb631f - lavf 52.46.0 - av_match_ext()
Add av_match_ext(), it should be used in place of match_ext().
-2010-01-01 - r20991 - lavf 52.45.0 - av_guess_format()
+2010-01-01 - a1f547b - lavf 52.45.0 - av_guess_format()
Add av_guess_format(), it should be used in place of guess_format().
-2009-12-13 - r20834 - lavf 52.43.0 - metadata API
+2009-12-13 - a181981 - lavf 52.43.0 - metadata API
Add av_metadata_set2(), AV_METADATA_DONT_STRDUP_KEY and
AV_METADATA_DONT_STRDUP_VAL.
-2009-12-13 - r20829 - lavu 50.7.0 - avstring.h API
+2009-12-13 - 277c733 - lavu 50.7.0 - avstring.h API
Add av_d2str().
-2009-12-13 - r20826 - lavc 52.42.0 - AVStream
+2009-12-13 - 02b398e - lavc 52.42.0 - AVStream
Add avg_frame_rate.
-2009-12-12 - r20808 - lavu 50.6.0 - av_bmg_next()
+2009-12-12 - 3ba69a1 - lavu 50.6.0 - av_bmg_next()
Introduce the av_bmg_next() function.
-2009-12-05 - r20734 - lavfi 1.12.0 - avfilter_draw_slice()
+2009-12-05 - a13a543 - lavfi 1.12.0 - avfilter_draw_slice()
Add a slice_dir parameter to avfilter_draw_slice().
-2009-11-26 - r20611 - lavfi 1.11.0 - AVFilter
+2009-11-26 - 4cc3f6a - lavfi 1.11.0 - AVFilter
Remove the next field from AVFilter, this is not anymore required.
-2009-11-25 - r20607 - lavfi 1.10.0 - avfilter_next()
+2009-11-25 - 1433c4a - lavfi 1.10.0 - avfilter_next()
Introduce the avfilter_next() function.
-2009-11-25 - r20605 - lavfi 1.9.0 - avfilter_register()
+2009-11-25 - 86a60fa - lavfi 1.9.0 - avfilter_register()
Change the signature of avfilter_register() to make it return an
int. This is required since now the registration operation may fail.
-2009-11-25 - r20603 - lavu 50.5.0 - pixdesc.h API
+2009-11-25 - 74a0059 - lavu 50.5.0 - pixdesc.h API
Make the pixdesc.h API public.
-2009-10-27 - r20385 - lavfi 1.5.0 - AVFilter.next
+2009-10-27 - 243110f - lavfi 1.5.0 - AVFilter.next
Add a next field to AVFilter, this is used for simplifying the
registration and management of the registered filters.
-2009-10-23 - r20356 - lavfi 1.4.1 - AVFilter.description
+2009-10-23 - cccd292 - lavfi 1.4.1 - AVFilter.description
Add a description field to AVFilter.
-2009-10-19 - r20302 - lavfi 1.3.0 - avfilter_make_format_list()
+2009-10-19 - 6b5dc05 - lavfi 1.3.0 - avfilter_make_format_list()
Change the interface of avfilter_make_format_list() from
avfilter_make_format_list(int n, ...) to
avfilter_make_format_list(enum PixelFormat *pix_fmts).
-2009-10-18 - r20272 - lavfi 1.0.0 - avfilter_get_video_buffer()
+2009-10-18 - 0eb4ff9 - lavfi 1.0.0 - avfilter_get_video_buffer()
Make avfilter_get_video_buffer() recursive and add the w and h
parameters to it.
-2009-10-07 - r20189 - lavfi 0.5.1 - AVFilterPic
+2009-10-07 - 46c40e4 - lavfi 0.5.1 - AVFilterPic
Add w and h fields to AVFilterPic.
-2009-06-22 - r19250 - lavf 52.34.1 - AVFormatContext.packet_size
+2009-06-22 - 92400be - lavf 52.34.1 - AVFormatContext.packet_size
This is now an unsigned int instead of a signed int.
-2009-06-19 - r19222 - lavc 52.32.0 - AVSubtitle.pts
+2009-06-19 - a4276ba - lavc 52.32.0 - AVSubtitle.pts
Add a pts field to AVSubtitle which gives the subtitle packet pts
in AV_TIME_BASE. Some subtitle de-/encoders (e.g. XSUB) will
not work right without this.
-2009-06-03 - r19078 - lavc 52.30.2 - AV_PKT_FLAG_KEY
+2009-06-03 - 8f3f2e0 - lavc 52.30.2 - AV_PKT_FLAG_KEY
PKT_FLAG_KEY has been deprecated and will be dropped at the next
major version. Use AV_PKT_FLAG_KEY instead.
-2009-06-01 - r19025 - lavc 52.30.0 - av_lockmgr_register()
+2009-06-01 - f988ce6 - lavc 52.30.0 - av_lockmgr_register()
av_lockmgr_register() can be used to register a callback function
that lavc (and in the future, libraries that depend on lavc) can use
to implement mutexes. The application should provide a callback function
@@ -1145,27 +1145,27 @@ API changes, most recent first:
When the lock manager is registered, FFmpeg is guaranteed to behave
correctly in a multi-threaded application.
-2009-04-30 - r18719 - lavc 52.28.0 - av_free_packet()
+2009-04-30 - ce1d9c8 - lavc 52.28.0 - av_free_packet()
av_free_packet() is no longer an inline function. It is now exported.
-2009-04-11 - r18431 - lavc 52.25.0 - deprecate av_destruct_packet_nofree()
+2009-04-11 - 80d403f - lavc 52.25.0 - deprecate av_destruct_packet_nofree()
Please use NULL instead. This has been supported since r16506
(lavf > 52.23.1, lavc > 52.10.0).
-2009-04-07 - r18351 - lavc 52.23.0 - avcodec_decode_video/audio/subtitle
+2009-04-07 - 7a00bba - lavc 52.23.0 - avcodec_decode_video/audio/subtitle
The old decoding functions are deprecated, all new code should use the
new functions avcodec_decode_video2(), avcodec_decode_audio3() and
avcodec_decode_subtitle2(). These new functions take an AVPacket *pkt
argument instead of a const uint8_t *buf / int buf_size pair.
-2009-04-03 - r18321 - lavu 50.3.0 - av_fifo_space()
+2009-04-03 - 7b09db3 - lavu 50.3.0 - av_fifo_space()
Introduce the av_fifo_space() function.
-2009-04-02 - r18317 - lavc 52.23.0 - AVPacket
+2009-04-02 - fabd246 - lavc 52.23.0 - AVPacket
Move AVPacket declaration from libavformat/avformat.h to
libavcodec/avcodec.h.
-2009-03-22 - r18163 - lavu 50.2.0 - RGB32 pixel formats
+2009-03-22 - 6e08ca9 - lavu 50.2.0 - RGB32 pixel formats
Convert the pixel formats PIX_FMT_ARGB, PIX_FMT_RGBA, PIX_FMT_ABGR,
PIX_FMT_BGRA, which were defined as macros, into enum PixelFormat values.
Conversely PIX_FMT_RGB32, PIX_FMT_RGB32_1, PIX_FMT_BGR32 and
@@ -1174,17 +1174,17 @@ API changes, most recent first:
Re-sort the enum PixelFormat list accordingly.
This change breaks API/ABI backward compatibility.
-2009-03-22 - r18133 - lavu 50.1.0 - PIX_FMT_RGB5X5 endian variants
+2009-03-22 - f82674e - lavu 50.1.0 - PIX_FMT_RGB5X5 endian variants
Add the enum PixelFormat values:
PIX_FMT_RGB565BE, PIX_FMT_RGB565LE, PIX_FMT_RGB555BE, PIX_FMT_RGB555LE,
PIX_FMT_BGR565BE, PIX_FMT_BGR565LE, PIX_FMT_BGR555BE, PIX_FMT_BGR555LE.
-2009-03-21 - r18116 - lavu 50.0.0 - av_random*
+2009-03-21 - ee6624e - lavu 50.0.0 - av_random*
The Mersenne Twister PRNG implemented through the av_random* functions
was removed. Use the lagged Fibonacci PRNG through the av_lfg* functions
instead.
-2009-03-08 - r17869 - lavu 50.0.0 - AVFifoBuffer
+2009-03-08 - 41dd680 - lavu 50.0.0 - AVFifoBuffer
av_fifo_init, av_fifo_read, av_fifo_write and av_fifo_realloc were dropped
and replaced by av_fifo_alloc, av_fifo_generic_read, av_fifo_generic_write
and av_fifo_realloc2.
@@ -1193,7 +1193,7 @@ API changes, most recent first:
The AVFifoBuffer/struct AVFifoBuffer may only be used in an opaque way by
applications, they may not use sizeof() or directly access members.
-2009-03-01 - r17682 - lavf 52.31.0 - Generic metadata API
+2009-03-01 - ec26457 - lavf 52.31.0 - Generic metadata API
Introduce a new metadata API (see av_metadata_get() and friends).
The old API is now deprecated and should not be used anymore. This especially
includes the following structure fields:
diff --git a/doc/general.texi b/doc/general.texi
index dd744f0641..0d520ad98c 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -401,6 +401,8 @@ following image formats are supported:
@tab YUV, JPEG and some extension is not supported yet.
@item Truevision Targa @tab X @tab X
@tab Targa (.TGA) image format
+@item XBM @tab X @tab
+ @tab X BitMap image format
@item XWD @tab X @tab X
@tab X Window Dump image format
@end multitable
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 69ba63228a..08a5728185 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -482,6 +482,7 @@ OBJS-$(CONFIG_XAN_DPCM_DECODER) += dpcm.o
OBJS-$(CONFIG_XAN_WC3_DECODER) += xan.o
OBJS-$(CONFIG_XAN_WC4_DECODER) += xxan.o
OBJS-$(CONFIG_XBIN_DECODER) += bintext.o cga_data.o
+OBJS-$(CONFIG_XBM_ENCODER) += xbmenc.o
OBJS-$(CONFIG_XL_DECODER) += xl.o
OBJS-$(CONFIG_XSUB_DECODER) += xsubdec.o
OBJS-$(CONFIG_XSUB_ENCODER) += xsubenc.o
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index d220f14933..d91ee917d9 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -5,7 +5,7 @@
*
* AAC LATM decoder
* Copyright (c) 2008-2010 Paul Kendall <paul@kcbbs.gen.nz>
- * Copyright (c) 2010 Janne Grunau <janne-ffmpeg@jannau.net>
+ * Copyright (c) 2010 Janne Grunau <janne-libav@jannau.net>
*
* This file is part of FFmpeg.
*
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 52a67f34bd..26ea1dc791 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -249,6 +249,7 @@ void avcodec_register_all(void)
REGISTER_DECODER (WNV1, wnv1);
REGISTER_DECODER (XAN_WC3, xan_wc3);
REGISTER_DECODER (XAN_WC4, xan_wc4);
+ REGISTER_ENCODER (XBM, xbm);
REGISTER_DECODER (XL, xl);
REGISTER_ENCDEC (XWD, xwd);
REGISTER_ENCDEC (Y41P, y41p);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index a3d5614fc3..235ebf2ec6 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -247,6 +247,7 @@ enum CodecID {
CODEC_ID_V410,
CODEC_ID_XWD,
CODEC_ID_CDXL,
+ CODEC_ID_XBM,
CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'),
CODEC_ID_AVRP = MKBETAG('A','V','R','P'),
diff --git a/libavcodec/bytestream.h b/libavcodec/bytestream.h
index 2d9ca47508..07463f1e3d 100644
--- a/libavcodec/bytestream.h
+++ b/libavcodec/bytestream.h
@@ -23,6 +23,7 @@
#ifndef AVCODEC_BYTESTREAM_H
#define AVCODEC_BYTESTREAM_H
+#include <stdint.h>
#include <string.h>
#include "libavutil/common.h"
@@ -37,7 +38,7 @@ typedef struct {
int eof;
} PutByteContext;
-#define DEF_T(type, name, bytes, read, write) \
+#define DEF(type, name, bytes, read, write) \
static av_always_inline type bytestream_get_ ## name(const uint8_t **b) \
{ \
(*b) += bytes; \
@@ -80,24 +81,15 @@ static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g) \
return read(g->buffer); \
}
-#define DEF(name, bytes, read, write) \
- DEF_T(unsigned int, name, bytes, read, write)
-#define DEF64(name, bytes, read, write) \
- DEF_T(uint64_t, name, bytes, read, write)
-
-DEF64(le64, 8, AV_RL64, AV_WL64)
-DEF (le32, 4, AV_RL32, AV_WL32)
-DEF (le24, 3, AV_RL24, AV_WL24)
-DEF (le16, 2, AV_RL16, AV_WL16)
-DEF64(be64, 8, AV_RB64, AV_WB64)
-DEF (be32, 4, AV_RB32, AV_WB32)
-DEF (be24, 3, AV_RB24, AV_WB24)
-DEF (be16, 2, AV_RB16, AV_WB16)
-DEF (byte, 1, AV_RB8 , AV_WB8 )
-
-#undef DEF
-#undef DEF64
-#undef DEF_T
+DEF(uint64_t, le64, 8, AV_RL64, AV_WL64)
+DEF(unsigned int, le32, 4, AV_RL32, AV_WL32)
+DEF(unsigned int, le24, 3, AV_RL24, AV_WL24)
+DEF(unsigned int, le16, 2, AV_RL16, AV_WL16)
+DEF(uint64_t, be64, 8, AV_RB64, AV_WB64)
+DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)
+DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
+DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)
+DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8)
#if HAVE_BIGENDIAN
# define bytestream2_get_ne16 bytestream2_get_be16
diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 16e64d1d08..d46401b754 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -184,6 +184,7 @@ typedef struct ProresContext {
int num_slices;
int num_planes;
int bits_per_mb;
+ int force_quant;
char *vendor;
int quant_sel;
@@ -397,7 +398,9 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic,
int plane_factor, is_chroma;
uint16_t *qmat;
- if (quant < MAX_STORED_Q) {
+ if (ctx->force_quant) {
+ qmat = ctx->quants[0];
+ } else if (quant < MAX_STORED_Q) {
qmat = ctx->quants[quant];
} else {
qmat = ctx->custom_q;
@@ -750,21 +753,23 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
// slices
for (y = 0; y < ctx->mb_height; y++) {
mbs_per_slice = ctx->mbs_per_slice;
- for (x = mb = 0; x < ctx->mb_width; x += mbs_per_slice, mb++) {
- while (ctx->mb_width - x < mbs_per_slice)
- mbs_per_slice >>= 1;
- q = find_slice_quant(avctx, pic, (mb + 1) * TRELLIS_WIDTH, x, y,
- mbs_per_slice);
- }
+ if (!ctx->force_quant) {
+ for (x = mb = 0; x < ctx->mb_width; x += mbs_per_slice, mb++) {
+ while (ctx->mb_width - x < mbs_per_slice)
+ mbs_per_slice >>= 1;
+ q = find_slice_quant(avctx, pic, (mb + 1) * TRELLIS_WIDTH, x, y,
+ mbs_per_slice);
+ }
- for (x = ctx->slices_width - 1; x >= 0; x--) {
- ctx->slice_q[x] = ctx->nodes[q].quant;
- q = ctx->nodes[q].prev_node;
+ for (x = ctx->slices_width - 1; x >= 0; x--) {
+ ctx->slice_q[x] = ctx->nodes[q].quant;
+ q = ctx->nodes[q].prev_node;
+ }
}
mbs_per_slice = ctx->mbs_per_slice;
for (x = mb = 0; x < ctx->mb_width; x += mbs_per_slice, mb++) {
- q = ctx->slice_q[mb];
+ q = ctx->force_quant ? ctx->force_quant : ctx->slice_q[mb];
while (ctx->mb_width - x < mbs_per_slice)
mbs_per_slice >>= 1;
@@ -859,27 +864,66 @@ static av_cold int encode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
- if (!ctx->bits_per_mb) {
- for (i = 0; i < NUM_MB_LIMITS - 1; i++)
- if (prores_mb_limits[i] >= ctx->mb_width * ctx->mb_height)
- break;
- ctx->bits_per_mb = ctx->profile_info->br_tab[i];
- } else if (ctx->bits_per_mb < 128) {
- av_log(avctx, AV_LOG_ERROR, "too few bits per MB, please set at least 128\n");
- return AVERROR_INVALIDDATA;
+ ctx->force_quant = avctx->global_quality / FF_QP2LAMBDA;
+ if (!ctx->force_quant) {
+ if (!ctx->bits_per_mb) {
+ for (i = 0; i < NUM_MB_LIMITS - 1; i++)
+ if (prores_mb_limits[i] >= ctx->mb_width * ctx->mb_height)
+ break;
+ ctx->bits_per_mb = ctx->profile_info->br_tab[i];
+ } else if (ctx->bits_per_mb < 128) {
+ av_log(avctx, AV_LOG_ERROR, "too few bits per MB, please set at least 128\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ min_quant = ctx->profile_info->min_quant;
+ max_quant = ctx->profile_info->max_quant;
+ for (i = min_quant; i < MAX_STORED_Q; i++) {
+ for (j = 0; j < 64; j++)
+ ctx->quants[i][j] = ctx->quant_mat[j] * i;
+ }
+
+ ctx->nodes = av_malloc((ctx->slices_width + 1) * TRELLIS_WIDTH
+ * sizeof(*ctx->nodes));
+ if (!ctx->nodes) {
+ encode_close(avctx);
+ return AVERROR(ENOMEM);
+ }
+ for (i = min_quant; i < max_quant + 2; i++) {
+ ctx->nodes[i].prev_node = -1;
+ ctx->nodes[i].bits = 0;
+ ctx->nodes[i].score = 0;
+ }
+
+ ctx->slice_q = av_malloc(ctx->slices_width * sizeof(*ctx->slice_q));
+ if (!ctx->slice_q) {
+ encode_close(avctx);
+ return AVERROR(ENOMEM);
+ }
+ } else {
+ int ls = 0;
+
+ if (ctx->force_quant > 64) {
+ av_log(avctx, AV_LOG_ERROR, "too large quantiser, maximum is 64\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ for (j = 0; j < 64; j++) {
+ ctx->quants[0][j] = ctx->quant_mat[j] * ctx->force_quant;
+ ls += av_log2((1 << 11) / ctx->quants[0][j]) * 2 + 1;
+ }
+
+ ctx->bits_per_mb = ls * 8;
+ if (ctx->chroma_factor == CFACTOR_Y444)
+ ctx->bits_per_mb += ls * 4;
+ if (ctx->num_planes == 4)
+ ctx->bits_per_mb += ls * 4;
}
ctx->frame_size = ctx->num_slices * (2 + 2 * ctx->num_planes
+ (2 * mps * ctx->bits_per_mb) / 8)
+ 200;
- min_quant = ctx->profile_info->min_quant;
- max_quant = ctx->profile_info->max_quant;
- for (i = min_quant; i < MAX_STORED_Q; i++) {
- for (j = 0; j < 64; j++)
- ctx->quants[i][j] = ctx->quant_mat[j] * i;
- }
-
avctx->codec_tag = ctx->profile_info->tag;
av_log(avctx, AV_LOG_DEBUG, "profile %d, %d slices, %d bits per MB\n",
@@ -887,24 +931,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_DEBUG, "estimated frame size %d\n",
ctx->frame_size);
- ctx->nodes = av_malloc((ctx->slices_width + 1) * TRELLIS_WIDTH
- * sizeof(*ctx->nodes));
- if (!ctx->nodes) {
- encode_close(avctx);
- return AVERROR(ENOMEM);
- }
- for (i = min_quant; i < max_quant + 2; i++) {
- ctx->nodes[i].prev_node = -1;
- ctx->nodes[i].bits = 0;
- ctx->nodes[i].score = 0;
- }
-
- ctx->slice_q = av_malloc(ctx->slices_width * sizeof(*ctx->slice_q));
- if (!ctx->slice_q) {
- encode_close(avctx);
- return AVERROR(ENOMEM);
- }
-
return 0;
}
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 95fbd00450..c91ac2298b 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -21,7 +21,7 @@
#define AVCODEC_VERSION_H
#define LIBAVCODEC_VERSION_MAJOR 54
-#define LIBAVCODEC_VERSION_MINOR 10
+#define LIBAVCODEC_VERSION_MINOR 11
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c
index ba70a11c59..6579b8f004 100644
--- a/libavcodec/vqavideo.c
+++ b/libavcodec/vqavideo.c
@@ -70,10 +70,10 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
+#include "bytestream.h"
#define PALETTE_COUNT 256
#define VQA_HEADER_SIZE 0x2A
-#define CHUNK_PREAMBLE_SIZE 8
/* allocate the maximum vector space, regardless of the file version:
* (0xFF00 codebook vectors + 0x100 solid pixel vectors) * (4x4 pixels/block) */
@@ -94,9 +94,7 @@ typedef struct VqaContext {
AVCodecContext *avctx;
AVFrame frame;
-
- const unsigned char *buf;
- int size;
+ GetByteContext gb;
uint32_t palette[PALETTE_COUNT];
@@ -123,7 +121,6 @@ typedef struct VqaContext {
static av_cold int vqa_decode_init(AVCodecContext *avctx)
{
VqaContext *s = avctx->priv_data;
- unsigned char *vqa_header;
int i, j, codebook_index;
s->avctx = avctx;
@@ -136,21 +133,20 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx)
}
/* load up the VQA parameters from the header */
- vqa_header = (unsigned char *)s->avctx->extradata;
- s->vqa_version = vqa_header[0];
+ s->vqa_version = s->avctx->extradata[0];
if (s->vqa_version < 1 || s->vqa_version > 3) {
av_log(s->avctx, AV_LOG_ERROR, " VQA video: unsupported version %d\n", s->vqa_version);
return -1;
}
- s->width = AV_RL16(&vqa_header[6]);
- s->height = AV_RL16(&vqa_header[8]);
+ s->width = AV_RL16(&s->avctx->extradata[6]);
+ s->height = AV_RL16(&s->avctx->extradata[8]);
if(av_image_check_size(s->width, s->height, 0, avctx)){
s->width= s->height= 0;
return -1;
}
- s->vector_width = vqa_header[10];
- s->vector_height = vqa_header[11];
- s->partial_count = s->partial_countdown = vqa_header[13];
+ s->vector_width = s->avctx->extradata[10];
+ s->vector_height = s->avctx->extradata[11];
+ s->partial_count = s->partial_countdown = s->avctx->extradata[13];
/* the vector dimensions have to meet very stringent requirements */
if ((s->vector_width != 4) ||
@@ -205,90 +201,88 @@ fail:
av_log(NULL, AV_LOG_ERROR, " VQA video: decode_format80 problem: next op would overflow dest_index\n"); \
av_log(NULL, AV_LOG_ERROR, " VQA video: current dest_index = %d, count = %d, dest_size = %d\n", \
dest_index, count, dest_size); \
- return; \
+ return AVERROR_INVALIDDATA; \
+ }
+
+#define CHECK_COPY(idx) \
+ if (idx < 0 || idx + count > dest_size) { \
+ av_log(NULL, AV_LOG_ERROR, " VQA video: decode_format80 problem: next op would overflow dest_index\n"); \
+ av_log(NULL, AV_LOG_ERROR, " VQA video: current src_pos = %d, count = %d, dest_size = %d\n", \
+ src_pos, count, dest_size); \
+ return AVERROR_INVALIDDATA; \
}
-static void decode_format80(const unsigned char *src, int src_size,
+
+static int decode_format80(GetByteContext *gb, int src_size,
unsigned char *dest, int dest_size, int check_size) {
- int src_index = 0;
int dest_index = 0;
- int count;
+ int count, opcode, start;
int src_pos;
unsigned char color;
int i;
- while (src_index < src_size) {
-
- av_dlog(NULL, " opcode %02X: ", src[src_index]);
+ start = bytestream2_tell(gb);
+ while (bytestream2_tell(gb) - start < src_size) {
+ opcode = bytestream2_get_byte(gb);
+ av_dlog(NULL, " opcode %02X: ", opcode);
/* 0x80 means that frame is finished */
- if (src[src_index] == 0x80)
- return;
+ if (opcode == 0x80)
+ return 0;
if (dest_index >= dest_size) {
av_log(NULL, AV_LOG_ERROR, " VQA video: decode_format80 problem: dest_index (%d) exceeded dest_size (%d)\n",
dest_index, dest_size);
- return;
+ return AVERROR_INVALIDDATA;
}
- if (src[src_index] == 0xFF) {
+ if (opcode == 0xFF) {
- src_index++;
- count = AV_RL16(&src[src_index]);
- src_index += 2;
- src_pos = AV_RL16(&src[src_index]);
- src_index += 2;
+ count = bytestream2_get_le16(gb);
+ src_pos = bytestream2_get_le16(gb);
av_dlog(NULL, "(1) copy %X bytes from absolute pos %X\n", count, src_pos);
CHECK_COUNT();
- if (src_pos + count > dest_size)
- return;
+ CHECK_COPY(src_pos);
for (i = 0; i < count; i++)
dest[dest_index + i] = dest[src_pos + i];
dest_index += count;
- } else if (src[src_index] == 0xFE) {
+ } else if (opcode == 0xFE) {
- src_index++;
- count = AV_RL16(&src[src_index]);
- src_index += 2;
- color = src[src_index++];
+ count = bytestream2_get_le16(gb);
+ color = bytestream2_get_byte(gb);
av_dlog(NULL, "(2) set %X bytes to %02X\n", count, color);
CHECK_COUNT();
memset(&dest[dest_index], color, count);
dest_index += count;
- } else if ((src[src_index] & 0xC0) == 0xC0) {
+ } else if ((opcode & 0xC0) == 0xC0) {
- count = (src[src_index++] & 0x3F) + 3;
- src_pos = AV_RL16(&src[src_index]);
- src_index += 2;
+ count = (opcode & 0x3F) + 3;
+ src_pos = bytestream2_get_le16(gb);
av_dlog(NULL, "(3) copy %X bytes from absolute pos %X\n", count, src_pos);
CHECK_COUNT();
- if (src_pos + count > dest_size)
- return;
+ CHECK_COPY(src_pos);
for (i = 0; i < count; i++)
dest[dest_index + i] = dest[src_pos + i];
dest_index += count;
- } else if (src[src_index] > 0x80) {
+ } else if (opcode > 0x80) {
- count = src[src_index++] & 0x3F;
+ count = opcode & 0x3F;
av_dlog(NULL, "(4) copy %X bytes from source to dest\n", count);
CHECK_COUNT();
- memcpy(&dest[dest_index], &src[src_index], count);
- src_index += count;
+ bytestream2_get_buffer(gb, &dest[dest_index], count);
dest_index += count;
} else {
- count = ((src[src_index] & 0x70) >> 4) + 3;
- src_pos = AV_RB16(&src[src_index]) & 0x0FFF;
- src_index += 2;
+ count = ((opcode & 0x70) >> 4) + 3;
+ src_pos = bytestream2_get_byte(gb) | ((opcode & 0x0F) << 8);
av_dlog(NULL, "(5) copy %X bytes from relpos %X\n", count, src_pos);
CHECK_COUNT();
- if (dest_index < src_pos)
- return;
+ CHECK_COPY(dest_index - src_pos);
for (i = 0; i < count; i++)
dest[dest_index + i] = dest[dest_index - src_pos + i];
dest_index += count;
@@ -303,9 +297,11 @@ static void decode_format80(const unsigned char *src, int src_size,
if (dest_index < dest_size)
av_log(NULL, AV_LOG_ERROR, " VQA video: decode_format80 problem: decode finished with dest_index (%d) < dest_size (%d)\n",
dest_index, dest_size);
+
+ return 0; // let's display what we decoded anyway
}
-static void vqa_decode_chunk(VqaContext *s)
+static int vqa_decode_chunk(VqaContext *s)
{
unsigned int chunk_type;
unsigned int chunk_size;
@@ -314,6 +310,7 @@ static void vqa_decode_chunk(VqaContext *s)
int i;
unsigned char r, g, b;
int index_shift;
+ int res;
int cbf0_chunk = -1;
int cbfz_chunk = -1;
@@ -333,17 +330,11 @@ static void vqa_decode_chunk(VqaContext *s)
int hibytes = s->decode_buffer_size / 2;
/* first, traverse through the frame and find the subchunks */
- while (index + CHUNK_PREAMBLE_SIZE <= s->size) {
- unsigned next_index;
+ while (bytestream2_get_bytes_left(&s->gb) >= 8) {
- chunk_type = AV_RB32(&s->buf[index]);
- chunk_size = AV_RB32(&s->buf[index + 4]);
- byte_skip = chunk_size & 0x01;
- next_index = index + CHUNK_PREAMBLE_SIZE + chunk_size + byte_skip;
- if (next_index > s->size) {
- av_log(s->avctx, AV_LOG_ERROR, "Dropping incomplete chunk\n");
- break;
- }
+ chunk_type = bytestream2_get_be32u(&s->gb);
+ index = bytestream2_tell(&s->gb);
+ chunk_size = bytestream2_get_be32u(&s->gb);
switch (chunk_type) {
@@ -384,7 +375,9 @@ static void vqa_decode_chunk(VqaContext *s)
chunk_type);
break;
}
- index = next_index;
+
+ byte_skip = chunk_size & 0x01;
+ bytestream2_skip(&s->gb, chunk_size + byte_skip);
}
/* next, deal with the palette */
@@ -392,7 +385,7 @@ static void vqa_decode_chunk(VqaContext *s)
/* a chunk should not have both chunk types */
av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found both CPL0 and CPLZ chunks\n");
- return;
+ return AVERROR_INVALIDDATA;
}
/* decompress the palette chunk */
@@ -405,19 +398,19 @@ static void vqa_decode_chunk(VqaContext *s)
/* convert the RGB palette into the machine's endian format */
if (cpl0_chunk != -1) {
- chunk_size = AV_RB32(&s->buf[cpl0_chunk + 4]);
+ bytestream2_seek(&s->gb, cpl0_chunk, SEEK_SET);
+ chunk_size = bytestream2_get_be32(&s->gb);
/* sanity check the palette size */
if (chunk_size / 3 > 256) {
av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found a palette chunk with %d colors\n",
chunk_size / 3);
- return;
+ return AVERROR_INVALIDDATA;
}
- cpl0_chunk += CHUNK_PREAMBLE_SIZE;
for (i = 0; i < chunk_size / 3; i++) {
/* scale by 4 to transform 6-bit palette -> 8-bit */
- r = s->buf[cpl0_chunk++] * 4;
- g = s->buf[cpl0_chunk++] * 4;
- b = s->buf[cpl0_chunk++] * 4;
+ r = bytestream2_get_byteu(&s->gb) * 4;
+ g = bytestream2_get_byteu(&s->gb) * 4;
+ b = bytestream2_get_byteu(&s->gb) * 4;
s->palette[i] = 0xFF << 24 | r << 16 | g << 8 | b;
s->palette[i] |= s->palette[i] >> 6 & 0x30303;
}
@@ -428,31 +421,32 @@ static void vqa_decode_chunk(VqaContext *s)
/* a chunk should not have both chunk types */
av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found both CBF0 and CBFZ chunks\n");
- return;
+ return AVERROR_INVALIDDATA;
}
/* decompress the full codebook chunk */
if (cbfz_chunk != -1) {
- chunk_size = AV_RB32(&s->buf[cbfz_chunk + 4]);
- cbfz_chunk += CHUNK_PREAMBLE_SIZE;
- decode_format80(&s->buf[cbfz_chunk], chunk_size,
- s->codebook, s->codebook_size, 0);
+ bytestream2_seek(&s->gb, cbfz_chunk, SEEK_SET);
+ chunk_size = bytestream2_get_be32(&s->gb);
+ if ((res = decode_format80(&s->gb, chunk_size, s->codebook,
+ s->codebook_size, 0)) < 0)
+ return res;
}
/* copy a full codebook */
if (cbf0_chunk != -1) {
- chunk_size = AV_RB32(&s->buf[cbf0_chunk + 4]);
+ bytestream2_seek(&s->gb, cbf0_chunk, SEEK_SET);
+ chunk_size = bytestream2_get_be32(&s->gb);
/* sanity check the full codebook size */
if (chunk_size > MAX_CODEBOOK_SIZE) {
av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: CBF0 chunk too large (0x%X bytes)\n",
chunk_size);
- return;
+ return AVERROR_INVALIDDATA;
}
- cbf0_chunk += CHUNK_PREAMBLE_SIZE;
- memcpy(s->codebook, &s->buf[cbf0_chunk], chunk_size);
+ bytestream2_get_buffer(&s->gb, s->codebook, chunk_size);
}
/* decode the frame */
@@ -460,13 +454,14 @@ static void vqa_decode_chunk(VqaContext *s)
/* something is wrong if there is no VPTZ chunk */
av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: no VPTZ chunk found\n");
- return;
+ return AVERROR_INVALIDDATA;
}
- chunk_size = AV_RB32(&s->buf[vptz_chunk + 4]);
- vptz_chunk += CHUNK_PREAMBLE_SIZE;
- decode_format80(&s->buf[vptz_chunk], chunk_size,
- s->decode_buffer, s->decode_buffer_size, 1);
+ bytestream2_seek(&s->gb, vptz_chunk, SEEK_SET);
+ chunk_size = bytestream2_get_be32(&s->gb);
+ if ((res = decode_format80(&s->gb, chunk_size,
+ s->decode_buffer, s->decode_buffer_size, 1)) < 0)
+ return res;
/* render the final PAL8 frame */
if (s->vector_height == 4)
@@ -530,17 +525,17 @@ static void vqa_decode_chunk(VqaContext *s)
if ((cbp0_chunk != -1) && (cbpz_chunk != -1)) {
/* a chunk should not have both chunk types */
av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found both CBP0 and CBPZ chunks\n");
- return;
+ return AVERROR_INVALIDDATA;
}
if (cbp0_chunk != -1) {
- chunk_size = AV_RB32(&s->buf[cbp0_chunk + 4]);
- cbp0_chunk += CHUNK_PREAMBLE_SIZE;
+ bytestream2_seek(&s->gb, cbp0_chunk, SEEK_SET);
+ chunk_size = bytestream2_get_be32(&s->gb);
/* accumulate partial codebook */
- memcpy(&s->next_codebook_buffer[s->next_codebook_buffer_index],
- &s->buf[cbp0_chunk], chunk_size);
+ bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index],
+ chunk_size);
s->next_codebook_buffer_index += chunk_size;
s->partial_countdown--;
@@ -558,39 +553,39 @@ static void vqa_decode_chunk(VqaContext *s)
if (cbpz_chunk != -1) {
- chunk_size = AV_RB32(&s->buf[cbpz_chunk + 4]);
- cbpz_chunk += CHUNK_PREAMBLE_SIZE;
+ bytestream2_seek(&s->gb, cbpz_chunk, SEEK_SET);
+ chunk_size = bytestream2_get_be32(&s->gb);
/* accumulate partial codebook */
- memcpy(&s->next_codebook_buffer[s->next_codebook_buffer_index],
- &s->buf[cbpz_chunk], chunk_size);
+ bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index],
+ chunk_size);
s->next_codebook_buffer_index += chunk_size;
s->partial_countdown--;
if (s->partial_countdown == 0) {
+ GetByteContext gb;
+ bytestream2_init(&gb, s->next_codebook_buffer, s->next_codebook_buffer_index);
/* decompress codebook */
- decode_format80(s->next_codebook_buffer,
- s->next_codebook_buffer_index,
- s->codebook, s->codebook_size, 0);
+ if ((res = decode_format80(&gb, s->next_codebook_buffer_index,
+ s->codebook, s->codebook_size, 0)) < 0)
+ return res;
/* reset accounting */
s->next_codebook_buffer_index = 0;
s->partial_countdown = s->partial_count;
}
}
+
+ return 0;
}
static int vqa_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
VqaContext *s = avctx->priv_data;
-
- s->buf = buf;
- s->size = buf_size;
+ int res;
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
@@ -600,7 +595,9 @@ static int vqa_decode_frame(AVCodecContext *avctx,
return -1;
}
- vqa_decode_chunk(s);
+ bytestream2_init(&s->gb, avpkt->data, avpkt->size);
+ if ((res = vqa_decode_chunk(s)) < 0)
+ return res;
/* make the palette available on the way out */
memcpy(s->frame.data[1], s->palette, PALETTE_COUNT * 4);
@@ -610,7 +607,7 @@ static int vqa_decode_frame(AVCodecContext *avctx,
*(AVFrame*)data = s->frame;
/* report that the buffer was completely consumed */
- return buf_size;
+ return avpkt->size;
}
static av_cold int vqa_decode_end(AVCodecContext *avctx)
diff --git a/libavcodec/xbmenc.c b/libavcodec/xbmenc.c
new file mode 100644
index 0000000000..2df6ae0d77
--- /dev/null
+++ b/libavcodec/xbmenc.c
@@ -0,0 +1,86 @@
+/*
+ * XBM image format
+ *
+ * Copyright (c) 2012 Paul B Mahol
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avcodec.h"
+#include "internal.h"
+
+static av_cold int xbm_encode_init(AVCodecContext *avctx)
+{
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
+ avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
+
+ return 0;
+}
+
+static int xbm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *p, int *got_packet)
+{
+ int i, j, ret, size, linesize;
+ uint8_t *ptr, *buf;
+
+ linesize = (avctx->width + 7) / 8;
+ size = avctx->height * (linesize * 7 + 2) + 110;
+ if ((ret = ff_alloc_packet(pkt, size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+
+ buf = pkt->data;
+ ptr = p->data[0];
+
+ buf += snprintf(buf, 32, "#define image_width %u\n", avctx->width);
+ buf += snprintf(buf, 33, "#define image_height %u\n", avctx->height);
+ buf += snprintf(buf, 40, "static unsigned char image_bits[] = {\n");
+ for (i = 0; i < avctx->height; i++) {
+ for (j = 0; j < linesize; j++)
+ buf += snprintf(buf, 7, " 0x%02X,", av_reverse[*ptr++]);
+ ptr += p->linesize[0] - linesize;
+ buf += snprintf(buf, 2, "\n");
+ }
+ buf += snprintf(buf, 5, " };\n");
+
+ pkt->size = buf - pkt->data;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ return 0;
+}
+
+static av_cold int xbm_encode_close(AVCodecContext *avctx)
+{
+ av_freep(&avctx->coded_frame);
+
+ return 0;
+}
+
+AVCodec ff_xbm_encoder = {
+ .name = "xbm",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = CODEC_ID_XBM,
+ .init = xbm_encode_init,
+ .encode2 = xbm_encode_frame,
+ .close = xbm_encode_close,
+ .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_MONOWHITE,
+ PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("XBM (X BitMap) image"),
+};
diff --git a/libavcodec/xwddec.c b/libavcodec/xwddec.c
index 97f3a6a979..2879358aa4 100644
--- a/libavcodec/xwddec.c
+++ b/libavcodec/xwddec.c
@@ -45,43 +45,43 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
uint32_t pixformat, pixdepth, bunit, bitorder, bpad;
uint32_t rgb[3];
uint8_t *ptr;
+ GetByteContext gb;
if (buf_size < XWD_HEADER_SIZE)
return AVERROR_INVALIDDATA;
- header_size = bytestream_get_be32(&buf);
- if (buf_size < header_size)
- return AVERROR_INVALIDDATA;
+ bytestream2_init(&gb, buf, buf_size);
+ header_size = bytestream2_get_be32u(&gb);
- version = bytestream_get_be32(&buf);
+ version = bytestream2_get_be32u(&gb);
if (version != XWD_VERSION) {
av_log(avctx, AV_LOG_ERROR, "unsupported version\n");
return AVERROR_INVALIDDATA;
}
- if (header_size < XWD_HEADER_SIZE) {
+ if (buf_size < header_size || header_size < XWD_HEADER_SIZE) {
av_log(avctx, AV_LOG_ERROR, "invalid header size\n");
return AVERROR_INVALIDDATA;
}
- pixformat = bytestream_get_be32(&buf);
- pixdepth = bytestream_get_be32(&buf);
- avctx->width = bytestream_get_be32(&buf);
- avctx->height = bytestream_get_be32(&buf);
- xoffset = bytestream_get_be32(&buf);
- be = bytestream_get_be32(&buf);
- bunit = bytestream_get_be32(&buf);
- bitorder = bytestream_get_be32(&buf);
- bpad = bytestream_get_be32(&buf);
- bpp = bytestream_get_be32(&buf);
- lsize = bytestream_get_be32(&buf);
- vclass = bytestream_get_be32(&buf);
- rgb[0] = bytestream_get_be32(&buf);
- rgb[1] = bytestream_get_be32(&buf);
- rgb[2] = bytestream_get_be32(&buf);
- buf += 8;
- ncolors = bytestream_get_be32(&buf);
- buf += header_size - (XWD_HEADER_SIZE - 20);
+ pixformat = bytestream2_get_be32u(&gb);
+ pixdepth = bytestream2_get_be32u(&gb);
+ avctx->width = bytestream2_get_be32u(&gb);
+ avctx->height = bytestream2_get_be32u(&gb);
+ xoffset = bytestream2_get_be32u(&gb);
+ be = bytestream2_get_be32u(&gb);
+ bunit = bytestream2_get_be32u(&gb);
+ bitorder = bytestream2_get_be32u(&gb);
+ bpad = bytestream2_get_be32u(&gb);
+ bpp = bytestream2_get_be32u(&gb);
+ lsize = bytestream2_get_be32u(&gb);
+ vclass = bytestream2_get_be32u(&gb);
+ rgb[0] = bytestream2_get_be32u(&gb);
+ rgb[1] = bytestream2_get_be32u(&gb);
+ rgb[2] = bytestream2_get_be32u(&gb);
+ bytestream2_skipu(&gb, 8);
+ ncolors = bytestream2_get_be32u(&gb);
+ bytestream2_skipu(&gb, header_size - (XWD_HEADER_SIZE - 20));
av_log(avctx, AV_LOG_DEBUG, "pixformat %d, pixdepth %d, bunit %d, bitorder %d, bpad %d\n",
pixformat, pixdepth, bunit, bitorder, bpad);
@@ -143,7 +143,7 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
- if (buf_size < header_size + ncolors * XWD_CMAP_SIZE + avctx->height * lsize) {
+ if (bytestream2_get_bytes_left(&gb) < ncolors * XWD_CMAP_SIZE + avctx->height * lsize) {
av_log(avctx, AV_LOG_ERROR, "input buffer too small\n");
return AVERROR_INVALIDDATA;
}
@@ -192,7 +192,7 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
avctx->pix_fmt = be ? PIX_FMT_ABGR : PIX_FMT_RGBA;
}
- buf += ncolors * XWD_CMAP_SIZE;
+ bytestream2_skipu(&gb, ncolors * XWD_CMAP_SIZE);
break;
default:
av_log(avctx, AV_LOG_ERROR, "invalid visual class\n");
@@ -222,11 +222,13 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
for (i = 0; i < ncolors; i++) {
- buf += 4; // skip colormap entry number
- red = *buf; buf += 2;
- green = *buf; buf += 2;
- blue = *buf; buf += 2;
- buf += 2; // skip bitmask flag and padding
+ bytestream2_skipu(&gb, 4); // skip colormap entry number
+ red = bytestream2_get_byteu(&gb);
+ bytestream2_skipu(&gb, 1);
+ green = bytestream2_get_byteu(&gb);
+ bytestream2_skipu(&gb, 1);
+ blue = bytestream2_get_byteu(&gb);
+ bytestream2_skipu(&gb, 3); // skip bitmask flag and padding
dst[i] = red << 16 | green << 8 | blue;
}
@@ -234,8 +236,8 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
ptr = p->data[0];
for (i = 0; i < avctx->height; i++) {
- bytestream_get_buffer(&buf, ptr, rsize);
- buf += lsize - rsize;
+ bytestream2_get_bufferu(&gb, ptr, rsize);
+ bytestream2_skipu(&gb, lsize - rsize);
ptr += p->linesize[0];
}
diff --git a/libavformat/img2.c b/libavformat/img2.c
index 86c5866060..b23e944809 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -71,6 +71,7 @@ static const IdStrMap img_tags[] = {
{ CODEC_ID_JPEG2000 , "jpc"},
{ CODEC_ID_DPX , "dpx"},
{ CODEC_ID_PICTOR , "pic"},
+ { CODEC_ID_XBM , "xbm"},
{ CODEC_ID_XWD , "xwd"},
{ CODEC_ID_NONE , NULL}
};
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index 9b4b30e814..175b854b6a 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -153,7 +153,7 @@ AVOutputFormat ff_image2_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),
.extensions = "bmp,dpx,jls,jpeg,jpg,ljpg,pam,pbm,pcx,pgm,pgmyuv,png,"
"ppm,sgi,tga,tif,tiff,jp2,j2c,xwd,sun,ras,rs,im1,im8,im24,"
- "sunras",
+ "sunras,xbm",
.priv_data_size = sizeof(VideoMuxData),
.video_codec = CODEC_ID_MJPEG,
.write_header = write_header,
diff --git a/libavformat/utils.c b/libavformat/utils.c
index fa1cd135b9..a917b4269d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1749,14 +1749,6 @@ int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts,
static int seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, int flags){
int64_t pos_min, pos_max;
-#if 0
- AVStream *st;
-
- if (stream_index < 0)
- return -1;
-
- st= s->streams[stream_index];
-#endif
pos_min = s->data_offset;
pos_max = avio_size(s->pb) - 1;
@@ -1766,9 +1758,6 @@ static int seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, in
avio_seek(s->pb, pos, SEEK_SET);
-#if 0
- av_update_cur_dts(s, st, ts);
-#endif
return 0;
}
@@ -2593,10 +2582,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
- if (st->codec_info_nb_frames>2 && !st->avg_frame_rate.num && st->info->codec_info_duration)
- av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
- (st->codec_info_nb_frames-2)*(int64_t)st->time_base.den,
- st->info->codec_info_duration*(int64_t)st->time_base.num, 60000);
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample){
uint32_t tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);
@@ -2604,6 +2589,10 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
st->codec->codec_tag= tag;
}
+ if (st->codec_info_nb_frames>2 && !st->avg_frame_rate.num && st->info->codec_info_duration)
+ av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
+ (st->codec_info_nb_frames-2)*(int64_t)st->time_base.den,
+ st->info->codec_info_duration*(int64_t)st->time_base.num, 60000);
// the check for tb_unreliable() is not completely correct, since this is not about handling
// a unreliable/inexact time base, but a time base that is finer than necessary, as e.g.
// ipmovie.c produces.
@@ -2674,31 +2663,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
compute_chapters_end(ic);
-#if 0
- /* correct DTS for B-frame streams with no timestamps */
- for(i=0;i<ic->nb_streams;i++) {
- st = ic->streams[i];
- if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- if(b-frames){
- ppktl = &ic->packet_buffer;
- while(ppkt1){
- if(ppkt1->stream_index != i)
- continue;
- if(ppkt1->pkt->dts < 0)
- break;
- if(ppkt1->pkt->pts != AV_NOPTS_VALUE)
- break;
- ppkt1->pkt->dts -= delta;
- ppkt1= ppkt1->next;
- }
- if(ppkt1)
- continue;
- st->cur_dts -= delta;
- }
- }
- }
-#endif
-
find_stream_info_err:
for (i=0; i < ic->nb_streams; i++) {
if (ic->streams[i]->codec)
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index fabf36e9d2..e9863af01c 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -31,8 +31,7 @@ repfile="${outdir}/${test}.rep"
# $1=value1, $2=value2, $3=threshold
# prints 0 if absolute difference between value1 and value2 is <= threshold
compare(){
- v=$(echo "scale=2; if ($1 >= $2) { $1 - $2 } else { $2 - $1 }" | bc)
- echo "if ($v <= $3) { 0 } else { 1 }" | bc
+ echo "scale=2; v = $1 - $2; if (v < 0) v = -v; if (v > $3) r = 1; r" | bc
}
do_tiny_psnr(){
diff --git a/tests/ref/fate/vqa-cc b/tests/ref/fate/vqa-cc
index 3b00d0dae7..401a061b94 100644
--- a/tests/ref/fate/vqa-cc
+++ b/tests/ref/fate/vqa-cc
@@ -70,7 +70,6 @@
1, 53654, 53654, 1470, 2940, 0xac8bb6c8
0, 37, 37, 1, 192000, 0xb58c1566
1, 55124, 55124, 1470, 2940, 0xa503c73b
-0, 38, 38, 1, 192000, 0xb58c1566
1, 56594, 56594, 1470, 2940, 0x7cd588a3
1, 58064, 58064, 1470, 2940, 0xa6974b04
1, 59534, 59534, 1470, 2940, 0xbf448241