| OLD | NEW |
| (Empty) | |
| 1 diff -wurp -N orig/libavcodec/avcodec.h ffmpeg/libavcodec/avcodec.h |
| 2 --- orig/libavcodec/avcodec.h 2011-07-12 20:48:43.353855365 -0700 |
| 3 +++ ffmpeg/libavcodec/avcodec.h 2011-07-12 20:48:43.412968592 -0700 |
| 4 @@ -623,6 +623,7 @@ typedef struct RcOverride{ |
| 5 #define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizatio
ns. |
| 6 #define CODEC_FLAG2_SSIM 0x00100000 ///< Compute SSIM during encoding,
error[] values are undefined. |
| 7 #define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of int
ra blocks instead of keyframes. |
| 8 +#define CODEC_FLAG2_ALT_REF 0x00400000 ///< Allow encoder to insert alter
nate reference frames (VP8 only) |
| 9 |
| 10 /* Unsupported options : |
| 11 * Syntax Arithmetic coding (SAC) |
| 12 @@ -2862,6 +2863,18 @@ typedef struct AVCodecContext { |
| 13 int active_thread_type; |
| 14 |
| 15 /** |
| 16 + * Number of token partitions. |
| 17 + * Indicates number of sub-streams in the bitstream. Used for parallelized |
| 18 + * decoding. |
| 19 + * Valid values are 1, 2, 4 & 8 |
| 20 + * - encoding: Set by user. |
| 21 + * - decoding: unused |
| 22 + * |
| 23 + * @attention VP8 specific |
| 24 + */ |
| 25 + int token_partitions; |
| 26 + |
| 27 + /** |
| 28 * Set by the client if its custom get_buffer() callback can be called |
| 29 * from another thread, which allows faster multithreaded decoding. |
| 30 * draw_horiz_band() will be called from other threads regardless of this s
etting. |
| 31 diff -wurp -N orig/libavcodec/libvpxenc.c ffmpeg/libavcodec/libvpxenc.c |
| 32 --- orig/libavcodec/libvpxenc.c 2011-07-12 20:48:43.342949420 -0700 |
| 33 +++ ffmpeg/libavcodec/libvpxenc.c 2011-07-12 20:48:43.423129249 -0700 |
| 34 @@ -256,6 +256,15 @@ static av_cold int vp8_init(AVCodecConte |
| 35 } |
| 36 dump_enc_cfg(avctx, &enccfg); |
| 37 |
| 38 + /* With altref set an additional frame at the same pts may be produced. |
| 39 + Increasing the time_base gives the library a window to place these frame
s |
| 40 + ensuring strictly increasing timestamps. */ |
| 41 + if (avctx->flags2 & CODEC_FLAG2_ALT_REF) { |
| 42 + avctx->ticks_per_frame = 2; |
| 43 + avctx->time_base = av_mul_q(avctx->time_base, |
| 44 + (AVRational){1, avctx->ticks_per_fram
e}); |
| 45 + } |
| 46 + |
| 47 enccfg.g_w = avctx->width; |
| 48 enccfg.g_h = avctx->height; |
| 49 enccfg.g_timebase.num = avctx->time_base.num; |
| 50 @@ -338,6 +347,24 @@ static av_cold int vp8_init(AVCodecConte |
| 51 quality. */ |
| 52 if (avctx->profile != FF_PROFILE_UNKNOWN) |
| 53 enccfg.g_profile = avctx->profile; |
| 54 + switch (FFABS(avctx->level) / 100) { |
| 55 + case 1: |
| 56 + ctx->deadline = VPX_DL_BEST_QUALITY; |
| 57 + break; |
| 58 + case 2: |
| 59 + default: |
| 60 + ctx->deadline = VPX_DL_GOOD_QUALITY; |
| 61 + break; |
| 62 + case 3: |
| 63 + ctx->deadline = VPX_DL_REALTIME; |
| 64 + break; |
| 65 + } |
| 66 + av_log(avctx, AV_LOG_DEBUG, "Using deadline: %lu\n", ctx->deadline); |
| 67 + |
| 68 + if (avctx->level != FF_LEVEL_UNKNOWN) { |
| 69 + enccfg.g_error_resilient = avctx->level < 0; |
| 70 + ctx->cpuused = FFABS(avctx->level) % 100 - 16; //[-16,16] |
| 71 + } |
| 72 |
| 73 enccfg.g_error_resilient = ctx->flags & VP8F_ERROR_RESILIENT; |
| 74 |
| 75 @@ -357,6 +384,7 @@ static av_cold int vp8_init(AVCodecConte |
| 76 codecctl_int(avctx, VP8E_SET_STATIC_THRESHOLD, avctx->mb_threshold); |
| 77 codecctl_int(avctx, VP8E_SET_CQ_LEVEL, (int)avctx->crf); |
| 78 codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, !!(ctx->flags & VP8F_AUTO_A
LT_REF)); |
| 79 + // not sure: codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, !!(avctx->flag
s2 & CODEC_FLAG2_ALT_REF)); |
| 80 codecctl_int(avctx, VP8E_SET_ARNR_MAXFRAMES, ctx->arnr_max_frames); |
| 81 codecctl_int(avctx, VP8E_SET_ARNR_STRENGTH, ctx->arnr_strength); |
| 82 codecctl_int(avctx, VP8E_SET_ARNR_TYPE, ctx->arnr_type); |
| 83 diff -wurp -N orig/libavcodec/options.c ffmpeg/libavcodec/options.c |
| 84 --- orig/libavcodec/options.c 2011-07-12 20:48:43.342949420 -0700 |
| 85 +++ ffmpeg/libavcodec/options.c 2011-07-12 20:48:43.423129249 -0700 |
| 86 @@ -453,6 +453,8 @@ static const AVOption options[]={ |
| 87 {"thread_type", "select multithreading type", OFFSET(thread_type), FF_OPT_TYPE_
INT, {.dbl = FF_THREAD_SLICE|FF_THREAD_FRAME }, 0, INT_MAX, V|E|D, "thread_type"
}, |
| 88 {"slice", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_THREAD_SLICE }, INT_MIN, INT_M
AX, V|E|D, "thread_type"}, |
| 89 {"frame", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_THREAD_FRAME }, INT_MIN, INT_M
AX, V|E|D, "thread_type"}, |
| 90 +{"altref", "enable use of alternate reference frames (VP8/2-pass only)", 0, FF_
OPT_TYPE_CONST, CODEC_FLAG2_ALT_REF, INT_MIN, INT_MAX, V|E, "flags2"}, |
| 91 +{"token_partitions", "Number of sub-streams in bitstream (1,2,4,8). Used for pa
rallelized decoding.", OFFSET(token_partitions), FF_OPT_TYPE_INT, 1, 1, INT_MAX,
V|E}, |
| 92 {"vbv_delay", "initial buffer fill time in periods of 27Mhz clock", 0, FF_OPT_T
YPE_INT64, {.dbl = 0 }, 0, INT64_MAX}, |
| 93 {"audio_service_type", "audio service type", OFFSET(audio_service_type), FF_OPT
_TYPE_INT, {.dbl = AV_AUDIO_SERVICE_TYPE_MAIN }, 0, AV_AUDIO_SERVICE_TYPE_NB-1,
A|E, "audio_service_type"}, |
| 94 {"ma", "Main Audio Service", 0, FF_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYP
E_MAIN }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, |
| OLD | NEW |