OLD | NEW |
1 /* Copyright (c) 2010-2011 Xiph.Org Foundation, Skype Limited | 1 /* Copyright (c) 2010-2011 Xiph.Org Foundation, Skype Limited |
2 Written by Jean-Marc Valin and Koen Vos */ | 2 Written by Jean-Marc Valin and Koen Vos */ |
3 /* | 3 /* |
4 Redistribution and use in source and binary forms, with or without | 4 Redistribution and use in source and binary forms, with or without |
5 modification, are permitted provided that the following conditions | 5 modification, are permitted provided that the following conditions |
6 are met: | 6 are met: |
7 | 7 |
8 - Redistributions of source code must retain the above copyright | 8 - Redistributions of source code must retain the above copyright |
9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 extern "C" { | 39 extern "C" { |
40 #endif | 40 #endif |
41 | 41 |
42 /** @defgroup opus_errorcodes Error codes | 42 /** @defgroup opus_errorcodes Error codes |
43 * @{ | 43 * @{ |
44 */ | 44 */ |
45 /** No error @hideinitializer*/ | 45 /** No error @hideinitializer*/ |
46 #define OPUS_OK 0 | 46 #define OPUS_OK 0 |
47 /** One or more invalid/out of range arguments @hideinitializer*/ | 47 /** One or more invalid/out of range arguments @hideinitializer*/ |
48 #define OPUS_BAD_ARG -1 | 48 #define OPUS_BAD_ARG -1 |
49 /** The mode struct passed is invalid @hideinitializer*/ | 49 /** Not enough bytes allocated in the buffer @hideinitializer*/ |
50 #define OPUS_BUFFER_TOO_SMALL -2 | 50 #define OPUS_BUFFER_TOO_SMALL -2 |
51 /** An internal error was detected @hideinitializer*/ | 51 /** An internal error was detected @hideinitializer*/ |
52 #define OPUS_INTERNAL_ERROR -3 | 52 #define OPUS_INTERNAL_ERROR -3 |
53 /** The compressed data passed is corrupted @hideinitializer*/ | 53 /** The compressed data passed is corrupted @hideinitializer*/ |
54 #define OPUS_INVALID_PACKET -4 | 54 #define OPUS_INVALID_PACKET -4 |
55 /** Invalid/unsupported request number @hideinitializer*/ | 55 /** Invalid/unsupported request number @hideinitializer*/ |
56 #define OPUS_UNIMPLEMENTED -5 | 56 #define OPUS_UNIMPLEMENTED -5 |
57 /** An encoder or decoder structure is invalid or already freed @hideinitializer
*/ | 57 /** An encoder or decoder structure is invalid or already freed @hideinitializer
*/ |
58 #define OPUS_INVALID_STATE -6 | 58 #define OPUS_INVALID_STATE -6 |
59 /** Memory allocation has failed @hideinitializer*/ | 59 /** Memory allocation has failed @hideinitializer*/ |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 * <dd>Process signal for improved speech intelligibility.</dd> | 447 * <dd>Process signal for improved speech intelligibility.</dd> |
448 * <dt>#OPUS_APPLICATION_AUDIO</dt> | 448 * <dt>#OPUS_APPLICATION_AUDIO</dt> |
449 * <dd>Favor faithfulness to the original input.</dd> | 449 * <dd>Favor faithfulness to the original input.</dd> |
450 * <dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt> | 450 * <dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt> |
451 * <dd>Configure the minimum possible coding delay by disabling certain modes | 451 * <dd>Configure the minimum possible coding delay by disabling certain modes |
452 * of operation.</dd> | 452 * of operation.</dd> |
453 * </dl> | 453 * </dl> |
454 * @hideinitializer */ | 454 * @hideinitializer */ |
455 #define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, __opus_check_int_p
tr(x) | 455 #define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, __opus_check_int_p
tr(x) |
456 | 456 |
457 /** Gets the sampling rate the encoder or decoder was initialized with. | |
458 * This simply returns the <code>Fs</code> value passed to opus_encoder_init() | |
459 * or opus_decoder_init(). | |
460 * @param[out] x <tt>opus_int32 *</tt>: Sampling rate of encoder or decoder. | |
461 * @hideinitializer | |
462 */ | |
463 #define OPUS_GET_SAMPLE_RATE(x) OPUS_GET_SAMPLE_RATE_REQUEST, __opus_check_int_p
tr(x) | |
464 | |
465 /** Gets the total samples of delay added by the entire codec. | 457 /** Gets the total samples of delay added by the entire codec. |
466 * This can be queried by the encoder and then the provided number of samples c
an be | 458 * This can be queried by the encoder and then the provided number of samples c
an be |
467 * skipped on from the start of the decoder's output to provide time aligned in
put | 459 * skipped on from the start of the decoder's output to provide time aligned in
put |
468 * and output. From the perspective of a decoding application the real data beg
ins this many | 460 * and output. From the perspective of a decoding application the real data beg
ins this many |
469 * samples late. | 461 * samples late. |
470 * | 462 * |
471 * The decoder contribution to this delay is identical for all decoders, but th
e | 463 * The decoder contribution to this delay is identical for all decoders, but th
e |
472 * encoder portion of the delay may vary from implementation to implementation, | 464 * encoder portion of the delay may vary from implementation to implementation, |
473 * version to version, or even depend on the encoder's initial configuration. | 465 * version to version, or even depend on the encoder's initial configuration. |
474 * Applications needing delay compensation should call this CTL rather than | 466 * Applications needing delay compensation should call this CTL rather than |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 * (default: 24). | 530 * (default: 24). |
539 * @hideinitializer */ | 531 * @hideinitializer */ |
540 #define OPUS_SET_LSB_DEPTH(x) OPUS_SET_LSB_DEPTH_REQUEST, __opus_check_int(x) | 532 #define OPUS_SET_LSB_DEPTH(x) OPUS_SET_LSB_DEPTH_REQUEST, __opus_check_int(x) |
541 /** Gets the encoder's configured signal depth. | 533 /** Gets the encoder's configured signal depth. |
542 * @see OPUS_SET_LSB_DEPTH | 534 * @see OPUS_SET_LSB_DEPTH |
543 * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and | 535 * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and |
544 * 24 (default: 24). | 536 * 24 (default: 24). |
545 * @hideinitializer */ | 537 * @hideinitializer */ |
546 #define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x
) | 538 #define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x
) |
547 | 539 |
548 /** Gets the duration (in samples) of the last packet successfully decoded or co
ncealed. | |
549 * @param[out] x <tt>opus_int32 *</tt>: Number of samples (at current sampling
rate). | |
550 * @hideinitializer */ | |
551 #define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQUEST,
__opus_check_int_ptr(x) | |
552 | |
553 /** Configures the encoder's use of variable duration frames. | 540 /** Configures the encoder's use of variable duration frames. |
554 * When variable duration is enabled, the encoder is free to use a shorter fram
e | 541 * When variable duration is enabled, the encoder is free to use a shorter fram
e |
555 * size than the one requested in the opus_encode*() call. | 542 * size than the one requested in the opus_encode*() call. |
556 * It is then the user's responsibility | 543 * It is then the user's responsibility |
557 * to verify how much audio was encoded by checking the ToC byte of the encoded | 544 * to verify how much audio was encoded by checking the ToC byte of the encoded |
558 * packet. The part of the audio that was not encoded needs to be resent to the | 545 * packet. The part of the audio that was not encoded needs to be resent to the |
559 * encoder for the next call. Do not use this option unless you <b>really</b> | 546 * encoder for the next call. Do not use this option unless you <b>really</b> |
560 * know what you are doing. | 547 * know what you are doing. |
561 * @see OPUS_GET_EXPERT_VARIABLE_DURATION | 548 * @see OPUS_GET_EXPERT_VARIABLE_DURATION |
562 * @param[in] x <tt>opus_int32</tt>: Allowed values: | 549 * @param[in] x <tt>opus_int32</tt>: Allowed values: |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 /** Gets the final state of the codec's entropy coder. | 629 /** Gets the final state of the codec's entropy coder. |
643 * This is used for testing purposes, | 630 * This is used for testing purposes, |
644 * The encoder and decoder state should be identical after coding a payload | 631 * The encoder and decoder state should be identical after coding a payload |
645 * (assuming no data corruption or software bugs) | 632 * (assuming no data corruption or software bugs) |
646 * | 633 * |
647 * @param[out] x <tt>opus_uint32 *</tt>: Entropy coder state | 634 * @param[out] x <tt>opus_uint32 *</tt>: Entropy coder state |
648 * | 635 * |
649 * @hideinitializer */ | 636 * @hideinitializer */ |
650 #define OPUS_GET_FINAL_RANGE(x) OPUS_GET_FINAL_RANGE_REQUEST, __opus_check_uint_
ptr(x) | 637 #define OPUS_GET_FINAL_RANGE(x) OPUS_GET_FINAL_RANGE_REQUEST, __opus_check_uint_
ptr(x) |
651 | 638 |
652 /** Gets the pitch of the last decoded frame, if available. | |
653 * This can be used for any post-processing algorithm requiring the use of pitc
h, | |
654 * e.g. time stretching/shortening. If the last frame was not voiced, or if the | |
655 * pitch was not coded in the frame, then zero is returned. | |
656 * | |
657 * This CTL is only implemented for decoder instances. | |
658 * | |
659 * @param[out] x <tt>opus_int32 *</tt>: pitch period at 48 kHz (or 0 if not ava
ilable) | |
660 * | |
661 * @hideinitializer */ | |
662 #define OPUS_GET_PITCH(x) OPUS_GET_PITCH_REQUEST, __opus_check_int_ptr(x) | |
663 | |
664 /** Gets the encoder's configured bandpass or the decoder's last bandpass. | 639 /** Gets the encoder's configured bandpass or the decoder's last bandpass. |
665 * @see OPUS_SET_BANDWIDTH | 640 * @see OPUS_SET_BANDWIDTH |
666 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: | 641 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: |
667 * <dl> | 642 * <dl> |
668 * <dt>#OPUS_AUTO</dt> <dd>(default)</dd> | 643 * <dt>#OPUS_AUTO</dt> <dd>(default)</dd> |
669 * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd> | 644 * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd> |
670 * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd> | 645 * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd> |
671 * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd> | 646 * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd> |
672 * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd> | 647 * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd> |
673 * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband</dd> | 648 * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband</dd> |
674 * </dl> | 649 * </dl> |
675 * @hideinitializer */ | 650 * @hideinitializer */ |
676 #define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ptr(x
) | 651 #define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ptr(x
) |
677 | 652 |
| 653 /** Gets the sampling rate the encoder or decoder was initialized with. |
| 654 * This simply returns the <code>Fs</code> value passed to opus_encoder_init() |
| 655 * or opus_decoder_init(). |
| 656 * @param[out] x <tt>opus_int32 *</tt>: Sampling rate of encoder or decoder. |
| 657 * @hideinitializer |
| 658 */ |
| 659 #define OPUS_GET_SAMPLE_RATE(x) OPUS_GET_SAMPLE_RATE_REQUEST, __opus_check_int_p
tr(x) |
| 660 |
678 /**@}*/ | 661 /**@}*/ |
679 | 662 |
680 /** @defgroup opus_decoderctls Decoder related CTLs | 663 /** @defgroup opus_decoderctls Decoder related CTLs |
681 * @see opus_genericctls, opus_encoderctls, opus_decoder | 664 * @see opus_genericctls, opus_encoderctls, opus_decoder |
682 * @{ | 665 * @{ |
683 */ | 666 */ |
684 | 667 |
685 /** Configures decoder gain adjustment. | 668 /** Configures decoder gain adjustment. |
686 * Scales the decoded output by a factor specified in Q8 dB units. | 669 * Scales the decoded output by a factor specified in Q8 dB units. |
687 * This has a maximum range of -32768 to 32767 inclusive, and returns | 670 * This has a maximum range of -32768 to 32767 inclusive, and returns |
688 * OPUS_BAD_ARG otherwise. The default is zero indicating no adjustment. | 671 * OPUS_BAD_ARG otherwise. The default is zero indicating no adjustment. |
689 * This setting survives decoder reset. | 672 * This setting survives decoder reset. |
690 * | 673 * |
691 * gain = pow(10, x/(20.0*256)) | 674 * gain = pow(10, x/(20.0*256)) |
692 * | 675 * |
693 * @param[in] x <tt>opus_int32</tt>: Amount to scale PCM signal by in Q8 dB u
nits. | 676 * @param[in] x <tt>opus_int32</tt>: Amount to scale PCM signal by in Q8 dB u
nits. |
694 * @hideinitializer */ | 677 * @hideinitializer */ |
695 #define OPUS_SET_GAIN(x) OPUS_SET_GAIN_REQUEST, __opus_check_int(x) | 678 #define OPUS_SET_GAIN(x) OPUS_SET_GAIN_REQUEST, __opus_check_int(x) |
696 /** Gets the decoder's configured gain adjustment. @see OPUS_SET_GAIN | 679 /** Gets the decoder's configured gain adjustment. @see OPUS_SET_GAIN |
697 * | 680 * |
698 * @param[out] x <tt>opus_int32 *</tt>: Amount to scale PCM signal by in Q8 dB
units. | 681 * @param[out] x <tt>opus_int32 *</tt>: Amount to scale PCM signal by in Q8 dB
units. |
699 * @hideinitializer */ | 682 * @hideinitializer */ |
700 #define OPUS_GET_GAIN(x) OPUS_GET_GAIN_REQUEST, __opus_check_int_ptr(x) | 683 #define OPUS_GET_GAIN(x) OPUS_GET_GAIN_REQUEST, __opus_check_int_ptr(x) |
701 | 684 |
| 685 /** Gets the duration (in samples) of the last packet successfully decoded or co
ncealed. |
| 686 * @param[out] x <tt>opus_int32 *</tt>: Number of samples (at current sampling
rate). |
| 687 * @hideinitializer */ |
| 688 #define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQUEST,
__opus_check_int_ptr(x) |
| 689 |
| 690 /** Gets the pitch of the last decoded frame, if available. |
| 691 * This can be used for any post-processing algorithm requiring the use of pitc
h, |
| 692 * e.g. time stretching/shortening. If the last frame was not voiced, or if the |
| 693 * pitch was not coded in the frame, then zero is returned. |
| 694 * |
| 695 * This CTL is only implemented for decoder instances. |
| 696 * |
| 697 * @param[out] x <tt>opus_int32 *</tt>: pitch period at 48 kHz (or 0 if not ava
ilable) |
| 698 * |
| 699 * @hideinitializer */ |
| 700 #define OPUS_GET_PITCH(x) OPUS_GET_PITCH_REQUEST, __opus_check_int_ptr(x) |
| 701 |
702 /**@}*/ | 702 /**@}*/ |
703 | 703 |
704 /** @defgroup opus_libinfo Opus library information functions | 704 /** @defgroup opus_libinfo Opus library information functions |
705 * @{ | 705 * @{ |
706 */ | 706 */ |
707 | 707 |
708 /** Converts an opus error code into a human readable string. | 708 /** Converts an opus error code into a human readable string. |
709 * | 709 * |
710 * @param[in] error <tt>int</tt>: Error number | 710 * @param[in] error <tt>int</tt>: Error number |
711 * @returns Error string | 711 * @returns Error string |
712 */ | 712 */ |
713 OPUS_EXPORT const char *opus_strerror(int error); | 713 OPUS_EXPORT const char *opus_strerror(int error); |
714 | 714 |
715 /** Gets the libopus version string. | 715 /** Gets the libopus version string. |
716 * | 716 * |
717 * @returns Version string | 717 * @returns Version string |
718 */ | 718 */ |
719 OPUS_EXPORT const char *opus_get_version_string(void); | 719 OPUS_EXPORT const char *opus_get_version_string(void); |
720 /**@}*/ | 720 /**@}*/ |
721 | 721 |
722 #ifdef __cplusplus | 722 #ifdef __cplusplus |
723 } | 723 } |
724 #endif | 724 #endif |
725 | 725 |
726 #endif /* OPUS_DEFINES_H */ | 726 #endif /* OPUS_DEFINES_H */ |
OLD | NEW |