Originally committed as revision 24199 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -12,6 +12,11 @@ libavutil: 2009-03-08 · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | API changes, most recent first: | 13 | API changes, most recent first: |
| 14 | 14 | ||
| 15 | 2010-07-11 - r????? - lavc 52.83.0 | ||
| 16 | Add AVCodecContext.lpc_type and Add AVCodecContext.lpc_passes fields. | ||
| 17 | Add AVLPCType enum. | ||
| 18 | Deprecate AVCodecContext.use_lpc. | ||
| 19 | |||
| 15 | 2010-07-11 - r24185 - lavc 52.82.0 - avsubtitle_free() | 20 | 2010-07-11 - r24185 - lavc 52.82.0 - avsubtitle_free() |
| 16 | Add a function for free the contents of a AVSubtitle generated by | 21 | Add a function for free the contents of a AVSubtitle generated by |
| 17 | avcodec_decode_subtitle. | 22 | avcodec_decode_subtitle. |
| @@ -145,7 +145,8 @@ static void calc_predictor_params(AlacEncodeContext *s, int ch) · 144 unmodified lines | |||
| 145 | s->avctx->frame_size, | 145 | s->avctx->frame_size, |
| 146 | s->min_prediction_order, | 146 | s->min_prediction_order, |
| 147 | s->max_prediction_order, | 147 | s->max_prediction_order, |
| 148 | ALAC_MAX_LPC_PRECISION, coefs, shift, 1, | 148 | ALAC_MAX_LPC_PRECISION, coefs, shift, |
| 149 | AV_LPC_TYPE_LEVINSON, 0, | ||
| 149 | ORDER_METHOD_EST, ALAC_MAX_LPC_SHIFT, 1); | 150 | ORDER_METHOD_EST, ALAC_MAX_LPC_SHIFT, 1); |
| 150 | 151 | ||
| 151 | s->lpc[ch].lpc_order = opt_order; | 152 | s->lpc[ch].lpc_order = opt_order; |
| @@ -30,7 +30,7 @@ · 29 unmodified lines | |||
| 30 | #include "libavutil/avutil.h" | 30 | #include "libavutil/avutil.h" |
| 31 | 31 | ||
| 32 | #define LIBAVCODEC_VERSION_MAJOR 52 | 32 | #define LIBAVCODEC_VERSION_MAJOR 52 |
| 33 | #define LIBAVCODEC_VERSION_MINOR 82 | 33 | #define LIBAVCODEC_VERSION_MINOR 83 |
| 34 | #define LIBAVCODEC_VERSION_MICRO 0 | 34 | #define LIBAVCODEC_VERSION_MICRO 0 |
| 35 | 35 | ||
| 36 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 36 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| @@ -526,6 +526,18 @@ enum AVChromaLocation{ · 489 unmodified lines | |||
| 526 | AVCHROMA_LOC_NB , ///< Not part of ABI | 526 | AVCHROMA_LOC_NB , ///< Not part of ABI |
| 527 | }; | 527 | }; |
| 528 | 528 | ||
| 529 | /** | ||
| 530 | * LPC analysis type | ||
| 531 | */ | ||
| 532 | enum AVLPCType { | ||
| 533 | AV_LPC_TYPE_DEFAULT = -1, ///< use the codec default LPC type | ||
| 534 | AV_LPC_TYPE_NONE = 0, ///< do not use LPC prediction or use all zero coefficients | ||
| 535 | AV_LPC_TYPE_FIXED = 1, ///< fixed LPC coefficients | ||
| 536 | AV_LPC_TYPE_LEVINSON = 2, ///< Levinson-Durbin recursion | ||
| 537 | AV_LPC_TYPE_CHOLESKY = 3, ///< Cholesky factorization | ||
| 538 | AV_LPC_TYPE_NB , ///< Not part of ABI | ||
| 539 | }; | ||
| 540 | |||
| 529 | typedef struct RcOverride{ | 541 | typedef struct RcOverride{ |
| 530 | int start_frame; | 542 | int start_frame; |
| 531 | int end_frame; | 543 | int end_frame; |
| @@ -2413,12 +2425,15 @@ typedef struct AVCodecContext { · 1881 unmodified lines | |||
| 2413 | int compression_level; | 2425 | int compression_level; |
| 2414 | #define FF_COMPRESSION_DEFAULT -1 | 2426 | #define FF_COMPRESSION_DEFAULT -1 |
| 2415 | 2427 | ||
| 2428 | #if LIBAVCODEC_VERSION_MAJOR < 53 | ||
| 2416 | /** | 2429 | /** |
| 2417 | * Sets whether to use LPC mode - used by FLAC encoder. | 2430 | * Sets whether to use LPC mode - used by FLAC encoder. |
| 2418 | * - encoding: Set by user. | 2431 | * - encoding: Set by user. |
| 2419 | * - decoding: unused | 2432 | * - decoding: unused |
| 2433 | * @deprecated Deprecated in favor of lpc_type and lpc_passes. | ||
| 2420 | */ | 2434 | */ |
| 2421 | int use_lpc; | 2435 | int use_lpc; |
| 2436 | #endif | ||
| 2422 | 2437 | ||
| 2423 | /** | 2438 | /** |
| 2424 | * LPC coefficient precision - used by FLAC encoder | 2439 | * LPC coefficient precision - used by FLAC encoder |
| @@ -2672,6 +2687,20 @@ typedef struct AVCodecContext { · 247 unmodified lines | |||
| 2672 | float crf_max; | 2687 | float crf_max; |
| 2673 | 2688 | ||
| 2674 | int log_level_offset; | 2689 | int log_level_offset; |
| 2690 | |||
| 2691 | /** | ||
| 2692 | * Determines which LPC analysis algorithm to use. | ||
| 2693 | * - encoding: Set by user | ||
| 2694 | * - decoding: unused | ||
| 2695 | */ | ||
| 2696 | enum AVLPCType lpc_type; | ||
| 2697 | |||
| 2698 | /** | ||
| 2699 | * Number of passes to use for Cholesky factorization during LPC analysis | ||
| 2700 | * - encoding: Set by user | ||
| 2701 | * - decoding: unused | ||
| 2702 | */ | ||
| 2703 | int lpc_passes; | ||
| 2675 | } AVCodecContext; | 2704 | } AVCodecContext; |
| 2676 | 2705 | ||
| 2677 | /** | 2706 | /** |
| @@ -44,7 +44,8 @@ · 43 unmodified lines | |||
| 44 | typedef struct CompressionOptions { | 44 | typedef struct CompressionOptions { |
| 45 | int compression_level; | 45 | int compression_level; |
| 46 | int block_time_ms; | 46 | int block_time_ms; |
| 47 | int use_lpc; | 47 | enum AVLPCType lpc_type; |
| 48 | int lpc_passes; | ||
| 48 | int lpc_coeff_precision; | 49 | int lpc_coeff_precision; |
| 49 | int min_prediction_order; | 50 | int min_prediction_order; |
| 50 | int max_prediction_order; | 51 | int max_prediction_order; |
| @@ -208,7 +209,11 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) · 157 unmodified lines | |||
| 208 | } | 209 | } |
| 209 | 210 | ||
| 210 | s->options.block_time_ms = ((int[]){ 27, 27, 27,105,105,105,105,105,105,105,105,105,105})[level]; | 211 | s->options.block_time_ms = ((int[]){ 27, 27, 27,105,105,105,105,105,105,105,105,105,105})[level]; |
| 211 | s->options.use_lpc = ((int[]){ 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})[level]; | 212 | s->options.lpc_type = ((int[]){ AV_LPC_TYPE_FIXED, AV_LPC_TYPE_FIXED, AV_LPC_TYPE_FIXED, |
| 213 | AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, | ||
| 214 | AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, | ||
| 215 | AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, | ||
| 216 | AV_LPC_TYPE_LEVINSON})[level]; | ||
| 212 | s->options.min_prediction_order= ((int[]){ 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})[level]; | 217 | s->options.min_prediction_order= ((int[]){ 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})[level]; |
| 213 | s->options.max_prediction_order= ((int[]){ 3, 4, 4, 6, 8, 8, 8, 8, 12, 12, 12, 32, 32})[level]; | 218 | s->options.max_prediction_order= ((int[]){ 3, 4, 4, 6, 8, 8, 8, 8, 12, 12, 12, 32, 32})[level]; |
| 214 | s->options.prediction_order_method = ((int[]){ ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST, | 219 | s->options.prediction_order_method = ((int[]){ ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST, |
| @@ -220,45 +225,83 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) · 5 unmodified lines | |||
| 220 | s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level]; | 225 | s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level]; |
| 221 | 226 | ||
| 222 | /* set compression option overrides from AVCodecContext */ | 227 | /* set compression option overrides from AVCodecContext */ |
| 223 | if(avctx->use_lpc >= 0) { | 228 | #if LIBAVCODEC_VERSION_MAJOR < 53 |
| 224 | s->options.use_lpc = av_clip(avctx->use_lpc, 0, 11); | 229 | /* for compatibility with deprecated AVCodecContext.use_lpc */ |
| 225 | } | 230 | if (avctx->use_lpc == 0) { |
| 226 | if(s->options.use_lpc == 1) | 231 | s->options.lpc_type = AV_LPC_TYPE_FIXED; |
| 227 | av_log(avctx, AV_LOG_DEBUG, " use lpc: Levinson-Durbin recursion with Welch window\n"); | 232 | } else if (avctx->use_lpc == 1) { |
| 228 | else if(s->options.use_lpc > 1) | 233 | s->options.lpc_type = AV_LPC_TYPE_LEVINSON; |
| 229 | av_log(avctx, AV_LOG_DEBUG, " use lpc: Cholesky factorization\n"); | 234 | } else if (avctx->use_lpc > 1) { |
| 230 | 235 | s->options.lpc_type = AV_LPC_TYPE_CHOLESKY; | |
| 231 | if(avctx->min_prediction_order >= 0) { | 236 | s->options.lpc_passes = avctx->use_lpc - 1; |
| 232 | if(s->options.use_lpc) { | 237 | } |
| 233 | if(avctx->min_prediction_order < MIN_LPC_ORDER || | 238 | #endif |
| 234 | avctx->min_prediction_order > MAX_LPC_ORDER) { | 239 | if (avctx->lpc_type > AV_LPC_TYPE_DEFAULT) { |
| 235 | av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n", | 240 | if (avctx->lpc_type > AV_LPC_TYPE_CHOLESKY) { |
| 236 | avctx->min_prediction_order); | 241 | av_log(avctx, AV_LOG_ERROR, "unknown lpc type: %d\n", avctx->lpc_type); |
| 242 | return -1; | ||
| 243 | } | ||
| 244 | s->options.lpc_type = avctx->lpc_type; | ||
| 245 | if (s->options.lpc_type == AV_LPC_TYPE_CHOLESKY) { | ||
| 246 | if (avctx->lpc_passes < 0) { | ||
| 247 | // default number of passes for Cholesky | ||
| 248 | s->options.lpc_passes = 2; | ||
| 249 | } else if (avctx->lpc_passes == 0) { | ||
| 250 | av_log(avctx, AV_LOG_ERROR, "invalid number of lpc passes: %d\n", | ||
| 251 | avctx->lpc_passes); | ||
| 237 | return -1; | 252 | return -1; |
| 253 | } else { | ||
| 254 | s->options.lpc_passes = avctx->lpc_passes; | ||
| 238 | } | 255 | } |
| 239 | } else { | 256 | } |
| 257 | } | ||
| 258 | switch (s->options.lpc_type) { | ||
| 259 | case AV_LPC_TYPE_NONE: | ||
| 260 | av_log(avctx, AV_LOG_DEBUG, " lpc type: None\n"); | ||
| 261 | break; | ||
| 262 | case AV_LPC_TYPE_FIXED: | ||
| 263 | av_log(avctx, AV_LOG_DEBUG, " lpc type: Fixed pre-defined coefficients\n"); | ||
| 264 | break; | ||
| 265 | case AV_LPC_TYPE_LEVINSON: | ||
| 266 | av_log(avctx, AV_LOG_DEBUG, " lpc type: Levinson-Durbin recursion with Welch window\n"); | ||
| 267 | break; | ||
| 268 | case AV_LPC_TYPE_CHOLESKY: | ||
| 269 | av_log(avctx, AV_LOG_DEBUG, " lpc type: Cholesky factorization, %d pass%s\n", | ||
| 270 | s->options.lpc_passes, s->options.lpc_passes==1?"":"es"); | ||
| 271 | break; | ||
| 272 | } | ||
| 273 | |||
| 274 | if (s->options.lpc_type == AV_LPC_TYPE_NONE) { | ||
| 275 | s->options.min_prediction_order = 0; | ||
| 276 | } else if (avctx->min_prediction_order >= 0) { | ||
| 277 | if (s->options.lpc_type == AV_LPC_TYPE_FIXED) { | ||
| 240 | if(avctx->min_prediction_order > MAX_FIXED_ORDER) { | 278 | if(avctx->min_prediction_order > MAX_FIXED_ORDER) { |
| 241 | av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n", | 279 | av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n", |
| 242 | avctx->min_prediction_order); | 280 | avctx->min_prediction_order); |
| 243 | return -1; | 281 | return -1; |
| 244 | } | 282 | } |
| 283 | } else if(avctx->min_prediction_order < MIN_LPC_ORDER || | ||
| 284 | avctx->min_prediction_order > MAX_LPC_ORDER) { | ||
| 285 | av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n", | ||
| 286 | avctx->min_prediction_order); | ||
| 287 | return -1; | ||
| 245 | } | 288 | } |
| 246 | s->options.min_prediction_order = avctx->min_prediction_order; | 289 | s->options.min_prediction_order = avctx->min_prediction_order; |
| 247 | } | 290 | } |
| 248 | if(avctx->max_prediction_order >= 0) { | 291 | if (s->options.lpc_type == AV_LPC_TYPE_NONE) { |
| 249 | if(s->options.use_lpc) { | 292 | s->options.max_prediction_order = 0; |
| 250 | if(avctx->max_prediction_order < MIN_LPC_ORDER || | 293 | } else if (avctx->max_prediction_order >= 0) { |
| 251 | avctx->max_prediction_order > MAX_LPC_ORDER) { | 294 | if (s->options.lpc_type == AV_LPC_TYPE_FIXED) { |
| 252 | av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n", | ||
| 253 | avctx->max_prediction_order); | ||
| 254 | return -1; | ||
| 255 | } | ||
| 256 | } else { | ||
| 257 | if(avctx->max_prediction_order > MAX_FIXED_ORDER) { | 295 | if(avctx->max_prediction_order > MAX_FIXED_ORDER) { |
| 258 | av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n", | 296 | av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n", |
| 259 | avctx->max_prediction_order); | 297 | avctx->max_prediction_order); |
| 260 | return -1; | 298 | return -1; |
| 261 | } | 299 | } |
| 300 | } else if (avctx->max_prediction_order < MIN_LPC_ORDER || | ||
| 301 | avctx->max_prediction_order > MAX_LPC_ORDER) { | ||
| 302 | av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n", | ||
| 303 | avctx->max_prediction_order); | ||
| 304 | return -1; | ||
| 262 | } | 305 | } |
| 263 | s->options.max_prediction_order = avctx->max_prediction_order; | 306 | s->options.max_prediction_order = avctx->max_prediction_order; |
| 264 | } | 307 | } |
| @@ -754,7 +797,8 @@ static int encode_residual(FlacEncodeContext *ctx, int ch) · 489 unmodified lines | |||
| 754 | omethod = ctx->options.prediction_order_method; | 797 | omethod = ctx->options.prediction_order_method; |
| 755 | 798 | ||
| 756 | /* FIXED */ | 799 | /* FIXED */ |
| 757 | if(!ctx->options.use_lpc || max_order == 0 || (n <= max_order)) { | 800 | if (ctx->options.lpc_type == AV_LPC_TYPE_NONE || |
| 801 | ctx->options.lpc_type == AV_LPC_TYPE_FIXED || n <= max_order) { | ||
| 758 | uint32_t bits[MAX_FIXED_ORDER+1]; | 802 | uint32_t bits[MAX_FIXED_ORDER+1]; |
| 759 | if(max_order > MAX_FIXED_ORDER) max_order = MAX_FIXED_ORDER; | 803 | if(max_order > MAX_FIXED_ORDER) max_order = MAX_FIXED_ORDER; |
| 760 | opt_order = 0; | 804 | opt_order = 0; |
| @@ -780,8 +824,9 @@ static int encode_residual(FlacEncodeContext *ctx, int ch) · 19 unmodified lines | |||
| 780 | 824 | ||
| 781 | /* LPC */ | 825 | /* LPC */ |
| 782 | opt_order = ff_lpc_calc_coefs(&ctx->dsp, smp, n, min_order, max_order, | 826 | opt_order = ff_lpc_calc_coefs(&ctx->dsp, smp, n, min_order, max_order, |
| 783 | precision, coefs, shift, ctx->options.use_lpc, | 827 | precision, coefs, shift, ctx->options.lpc_type, |
| 784 | omethod, MAX_LPC_SHIFT, 0); | 828 | ctx->options.lpc_passes, omethod, |
| 829 | MAX_LPC_SHIFT, 0); | ||
| 785 | 830 | ||
| 786 | if(omethod == ORDER_METHOD_2LEVEL || | 831 | if(omethod == ORDER_METHOD_2LEVEL || |
| 787 | omethod == ORDER_METHOD_4LEVEL || | 832 | omethod == ORDER_METHOD_4LEVEL || |
| @@ -165,7 +165,8 @@ static int estimate_best_order(double *ref, int min_order, int max_order) · 164 unmodified lines | |||
| 165 | int ff_lpc_calc_coefs(DSPContext *s, | 165 | int ff_lpc_calc_coefs(DSPContext *s, |
| 166 | const int32_t *samples, int blocksize, int min_order, | 166 | const int32_t *samples, int blocksize, int min_order, |
| 167 | int max_order, int precision, | 167 | int max_order, int precision, |
| 168 | int32_t coefs[][MAX_LPC_ORDER], int *shift, int use_lpc, | 168 | int32_t coefs[][MAX_LPC_ORDER], int *shift, |
| 169 | enum AVLPCType lpc_type, int lpc_passes, | ||
| 169 | int omethod, int max_shift, int zero_shift) | 170 | int omethod, int max_shift, int zero_shift) |
| 170 | { | 171 | { |
| 171 | double autoc[MAX_LPC_ORDER+1]; | 172 | double autoc[MAX_LPC_ORDER+1]; |
| @@ -174,20 +175,21 @@ int ff_lpc_calc_coefs(DSPContext *s, · 2 unmodified lines | |||
| 174 | int i, j, pass; | 175 | int i, j, pass; |
| 175 | int opt_order; | 176 | int opt_order; |
| 176 | 177 | ||
| 177 | assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER && use_lpc > 0); | 178 | assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER && |
| 179 | lpc_type > AV_LPC_TYPE_FIXED); | ||
| 178 | 180 | ||
| 179 | if(use_lpc == 1){ | 181 | if (lpc_type == AV_LPC_TYPE_LEVINSON) { |
| 180 | s->lpc_compute_autocorr(samples, blocksize, max_order, autoc); | 182 | s->lpc_compute_autocorr(samples, blocksize, max_order, autoc); |
| 181 | 183 | ||
| 182 | compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1); | 184 | compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1); |
| 183 | 185 | ||
| 184 | for(i=0; i<max_order; i++) | 186 | for(i=0; i<max_order; i++) |
| 185 | ref[i] = fabs(lpc[i][i]); | 187 | ref[i] = fabs(lpc[i][i]); |
| 186 | }else{ | 188 | } else if (lpc_type == AV_LPC_TYPE_CHOLESKY) { |
| 187 | LLSModel m[2]; | 189 | LLSModel m[2]; |
| 188 | double var[MAX_LPC_ORDER+1], av_uninit(weight); | 190 | double var[MAX_LPC_ORDER+1], av_uninit(weight); |
| 189 | 191 | ||
| 190 | for(pass=0; pass<use_lpc-1; pass++){ | 192 | for(pass=0; pass<lpc_passes; pass++){ |
| 191 | av_init_lls(&m[pass&1], max_order); | 193 | av_init_lls(&m[pass&1], max_order); |
| 192 | 194 | ||
| 193 | weight=0; | 195 | weight=0; |
| @@ -42,7 +42,8 @@ · 41 unmodified lines | |||
| 42 | int ff_lpc_calc_coefs(DSPContext *s, | 42 | int ff_lpc_calc_coefs(DSPContext *s, |
| 43 | const int32_t *samples, int blocksize, int min_order, | 43 | const int32_t *samples, int blocksize, int min_order, |
| 44 | int max_order, int precision, | 44 | int max_order, int precision, |
| 45 | int32_t coefs[][MAX_LPC_ORDER], int *shift, int use_lpc, | 45 | int32_t coefs[][MAX_LPC_ORDER], int *shift, |
| 46 | enum AVLPCType lpc_type, int lpc_passes, | ||
| 46 | int omethod, int max_shift, int zero_shift); | 47 | int omethod, int max_shift, int zero_shift); |
| 47 | 48 | ||
| 48 | void ff_lpc_compute_autocorr(const int32_t *data, int len, int lag, | 49 | void ff_lpc_compute_autocorr(const int32_t *data, int len, int lag, |
| @@ -382,7 +382,9 @@ static const AVOption options[]={ · 381 unmodified lines | |||
| 382 | {"ivlc", "intra vlc table", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_INTRA_VLC, INT_MIN, INT_MAX, V|E, "flags2"}, | 382 | {"ivlc", "intra vlc table", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_INTRA_VLC, INT_MIN, INT_MAX, V|E, "flags2"}, |
| 383 | {"b_sensitivity", "adjusts sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), FF_OPT_TYPE_INT, 40, 1, INT_MAX, V|E}, | 383 | {"b_sensitivity", "adjusts sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), FF_OPT_TYPE_INT, 40, 1, INT_MAX, V|E}, |
| 384 | {"compression_level", NULL, OFFSET(compression_level), FF_OPT_TYPE_INT, FF_COMPRESSION_DEFAULT, INT_MIN, INT_MAX, V|A|E}, | 384 | {"compression_level", NULL, OFFSET(compression_level), FF_OPT_TYPE_INT, FF_COMPRESSION_DEFAULT, INT_MIN, INT_MAX, V|A|E}, |
| 385 | #if LIBAVCODEC_VERSION_MAJOR < 53 | ||
| 385 | {"use_lpc", "sets whether to use LPC mode (FLAC)", OFFSET(use_lpc), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, | 386 | {"use_lpc", "sets whether to use LPC mode (FLAC)", OFFSET(use_lpc), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, |
| 387 | #endif | ||
| 386 | {"lpc_coeff_precision", "LPC coefficient precision (FLAC)", OFFSET(lpc_coeff_precision), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|E}, | 388 | {"lpc_coeff_precision", "LPC coefficient precision (FLAC)", OFFSET(lpc_coeff_precision), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|E}, |
| 387 | {"min_prediction_order", NULL, OFFSET(min_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, | 389 | {"min_prediction_order", NULL, OFFSET(min_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, |
| 388 | {"max_prediction_order", NULL, OFFSET(max_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, | 390 | {"max_prediction_order", NULL, OFFSET(max_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, |
| @@ -417,6 +419,12 @@ static const AVOption options[]={ · 28 unmodified lines | |||
| 417 | {"intra_refresh", "use periodic insertion of intra blocks instead of keyframes", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_INTRA_REFRESH, INT_MIN, INT_MAX, V|E, "flags2"}, | 419 | {"intra_refresh", "use periodic insertion of intra blocks instead of keyframes", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_INTRA_REFRESH, INT_MIN, INT_MAX, V|E, "flags2"}, |
| 418 | {"crf_max", "in crf mode, prevents vbv from lowering quality beyond this point", OFFSET(crf_max), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 51, V|E}, | 420 | {"crf_max", "in crf mode, prevents vbv from lowering quality beyond this point", OFFSET(crf_max), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 51, V|E}, |
| 419 | {"log_level_offset", "set the log level offset", OFFSET(log_level_offset), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX }, | 421 | {"log_level_offset", "set the log level offset", OFFSET(log_level_offset), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX }, |
| 422 | {"lpc_type", "specify LPC algorithm", OFFSET(lpc_type), FF_OPT_TYPE_INT, AV_LPC_TYPE_DEFAULT, AV_LPC_TYPE_DEFAULT, AV_LPC_TYPE_NB-1, A|E}, | ||
| 423 | {"none", NULL, 0, FF_OPT_TYPE_CONST, AV_LPC_TYPE_NONE, INT_MIN, INT_MAX, A|E, "lpc_type"}, | ||
| 424 | {"fixed", NULL, 0, FF_OPT_TYPE_CONST, AV_LPC_TYPE_FIXED, INT_MIN, INT_MAX, A|E, "lpc_type"}, | ||
| 425 | {"levinson", NULL, 0, FF_OPT_TYPE_CONST, AV_LPC_TYPE_LEVINSON, INT_MIN, INT_MAX, A|E, "lpc_type"}, | ||
| 426 | {"cholesky", NULL, 0, FF_OPT_TYPE_CONST, AV_LPC_TYPE_CHOLESKY, INT_MIN, INT_MAX, A|E, "lpc_type"}, | ||
| 427 | {"lpc_passes", "number of passes to use for Cholesky factorization during LPC analysis", OFFSET(lpc_passes), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, | ||
| 420 | {NULL}, | 428 | {NULL}, |
| 421 | }; | 429 | }; |
| 422 | 430 | ||
| @@ -452,8 +452,8 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame, · 451 unmodified lines | |||
| 452 | 32)]; | 452 | 32)]; |
| 453 | 453 | ||
| 454 | ff_lpc_calc_coefs(&ractx->dsp, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER, | 454 | ff_lpc_calc_coefs(&ractx->dsp, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER, |
| 455 | LPC_ORDER, 16, lpc_coefs, shift, 1, ORDER_METHOD_EST, 12, | 455 | LPC_ORDER, 16, lpc_coefs, shift, AV_LPC_TYPE_LEVINSON, |
| 456 | 0); | 456 | 0, ORDER_METHOD_EST, 12, 0); |
| 457 | for (i = 0; i < LPC_ORDER; i++) | 457 | for (i = 0; i < LPC_ORDER; i++) |
| 458 | block_coefs[NBLOCKS - 1][i] = -(lpc_coefs[LPC_ORDER - 1][i] << | 458 | block_coefs[NBLOCKS - 1][i] = -(lpc_coefs[LPC_ORDER - 1][i] << |
| 459 | (12 - shift[LPC_ORDER - 1])); | 459 | (12 - shift[LPC_ORDER - 1])); |