* commit '8941971a8f2e24b9a84fe29f128d13ceb89c0a65': lavc: make error_rate a private option of mpegvideo encoders Conflicts: libavcodec/options_table.h libavcodec/version.h
Unified · Split
| @@ -15,6 +15,10 @@ libavutil: 2012-10-22 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2013-10-xx - xxxxxxx - lavc 55.27.0 - avcodec.h | |
| 19 | + Deprecate AVCodecContext.error_rate, it is replaced by the 'error_rate' | |
| 20 | + private option of the mpegvideo encoder family. | |
| 21 | + | |
| 18 | 22 | 2013-11-xx - xxxxxxx - lavc 55.26.0 - vdpau.h |
| 19 | 23 | Add av_vdpau_get_profile(). |
| 20 | 24 | Add av_vdpau_alloc_context(). This function must from now on be |
| @@ -2833,12 +2833,14 @@ typedef struct AVCodecContext { · 2832 unmodified lines | ||
| 2833 | 2833 | uint8_t *subtitle_header; |
| 2834 | 2834 | int subtitle_header_size; |
| 2835 | 2835 | |
| 2836 | +#if FF_API_ERROR_RATE | |
| 2836 | 2837 | /** |
| 2837 | − * Simulates errors in the bitstream to test error concealment. | |
| 2838 | − * - encoding: Set by user. | |
| 2839 | − * - decoding: unused | |
| 2838 | + * @deprecated use the 'error_rate' private AVOption of the mpegvideo | |
| 2839 | + * encoders | |
| 2840 | 2840 | */ |
| 2841 | + attribute_deprecated | |
| 2841 | 2842 | int error_rate; |
| 2843 | +#endif | |
| 2842 | 2844 | |
| 2843 | 2845 | #if FF_API_CODEC_PKT |
| 2844 | 2846 | /** |
| @@ -747,6 +747,8 @@ typedef struct MpegEncContext { · 746 unmodified lines | ||
| 747 | 747 | int context_reinit; |
| 748 | 748 | |
| 749 | 749 | ERContext er; |
| 750 | + | |
| 751 | + int error_rate; | |
| 750 | 752 | } MpegEncContext; |
| 751 | 753 | |
| 752 | 754 | #define REBASE_PICTURE(pic, new_ctx, old_ctx) \ |
| @@ -772,7 +774,9 @@ typedef struct MpegEncContext { · 19 unmodified lines | ||
| 772 | 774 | FF_MPV_OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\ |
| 773 | 775 | { "chroma_elim_threshold", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)",\ |
| 774 | 776 | FF_MPV_OFFSET(chroma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\ |
| 775 | −{ "quantizer_noise_shaping", NULL, FF_MPV_OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FF_MPV_OPT_FLAGS }, | |
| 777 | +{ "quantizer_noise_shaping", NULL, FF_MPV_OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FF_MPV_OPT_FLAGS },\ | |
| 778 | +{ "error_rate", "Simulate errors in the bitstream to test error concealment.", \ | |
| 779 | + FF_MPV_OFFSET(error_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FF_MPV_OPT_FLAGS }, | |
| 776 | 780 | |
| 777 | 781 | extern const AVOption ff_mpv_generic_options[]; |
| 778 | 782 | |
| @@ -882,6 +882,13 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) · 881 unmodified lines | ||
| 882 | 882 | if (ff_rate_control_init(s) < 0) |
| 883 | 883 | return -1; |
| 884 | 884 | |
| 885 | +#if FF_API_ERROR_RATE | |
| 886 | + FF_DISABLE_DEPRECATION_WARNINGS | |
| 887 | + if (avctx->error_rate) | |
| 888 | + s->error_rate = avctx->error_rate; | |
| 889 | + FF_ENABLE_DEPRECATION_WARNINGS; | |
| 890 | +#endif | |
| 891 | + | |
| 885 | 892 | return 0; |
| 886 | 893 | } |
| 887 | 894 | |
| @@ -2582,9 +2589,9 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 1694 unmodified lines | ||
| 2582 | 2589 | av_assert2((put_bits_count(&s->pb)&7) == 0); |
| 2583 | 2590 | current_packet_size= put_bits_ptr(&s->pb) - s->ptr_lastgob; |
| 2584 | 2591 | |
| 2585 | − if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){ | |
| 2592 | + if (s->error_rate && s->resync_mb_x + s->resync_mb_y > 0) { | |
| 2586 | 2593 | int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y; |
| 2587 | − int d= 100 / s->avctx->error_rate; | |
| 2594 | + int d = 100 / s->error_rate; | |
| 2588 | 2595 | if(r % d == 0){ |
| 2589 | 2596 | current_packet_size=0; |
| 2590 | 2597 | s->pb.buf_ptr= s->ptr_lastgob; |
| @@ -295,7 +295,9 @@ static const AVOption avcodec_options[] = { · 294 unmodified lines | ||
| 295 | 295 | {"nr", "noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, |
| 296 | 296 | {"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, |
| 297 | 297 | {"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, V|A|E|D, "flags2"}, |
| 298 | +#if FF_API_ERROR_RATE | |
| 298 | 299 | {"error", NULL, OFFSET(error_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, |
| 300 | +#endif | |
| 299 | 301 | {"threads", NULL, OFFSET(thread_count), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, INT_MAX, V|A|E|D, "threads"}, |
| 300 | 302 | {"auto", "autodetect a suitable number of threads to use", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, INT_MIN, INT_MAX, V|E|D, "threads"}, |
| 301 | 303 | {"me_threshold", "motion estimation threshold", OFFSET(me_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "libavutil/avutil.h" |
| 30 | 30 | |
| 31 | 31 | #define LIBAVCODEC_VERSION_MAJOR 55 |
| 32 | −#define LIBAVCODEC_VERSION_MINOR 42 | |
| 32 | +#define LIBAVCODEC_VERSION_MINOR 43 | |
| 33 | 33 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 34 | 34 | |
| 35 | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| @@ -120,5 +120,8 @@ · 84 unmodified lines | ||
| 120 | 120 | #ifndef FF_API_XVMC |
| 121 | 121 | #define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 56) |
| 122 | 122 | #endif |
| 123 | +#ifndef FF_API_ERROR_RATE | |
| 124 | +#define FF_API_ERROR_RATE (LIBAVCODEC_VERSION_MAJOR < 56) | |
| 125 | +#endif | |
| 123 | 126 | |
| 124 | 127 | #endif /* AVCODEC_VERSION_H */ |