~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to ffmpeg/libavcodec/sonic.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2008-12-26 00:10:06 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20081226001006-wd8cuqn8d81smkdp
Tags: upstream-1.1.7
ImportĀ upstreamĀ versionĀ 1.1.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
503
503
    return -1;
504
504
}
505
505
 
506
 
static int sonic_encode_init(AVCodecContext *avctx)
 
506
static av_cold int sonic_encode_init(AVCodecContext *avctx)
507
507
{
508
508
    SonicContext *s = avctx->priv_data;
509
509
    PutBitContext pb;
608
608
    return 0;
609
609
}
610
610
 
611
 
static int sonic_encode_close(AVCodecContext *avctx)
 
611
static av_cold int sonic_encode_close(AVCodecContext *avctx)
612
612
{
613
613
    SonicContext *s = avctx->priv_data;
614
614
    int i;
751
751
#endif //CONFIG_ENCODERS
752
752
 
753
753
#ifdef CONFIG_DECODERS
754
 
static int sonic_decode_init(AVCodecContext *avctx)
 
754
static av_cold int sonic_decode_init(AVCodecContext *avctx)
755
755
{
756
756
    SonicContext *s = avctx->priv_data;
757
757
    GetBitContext gb;
831
831
    return 0;
832
832
}
833
833
 
834
 
static int sonic_decode_close(AVCodecContext *avctx)
 
834
static av_cold int sonic_decode_close(AVCodecContext *avctx)
835
835
{
836
836
    SonicContext *s = avctx->priv_data;
837
837
    int i;
851
851
 
852
852
static int sonic_decode_frame(AVCodecContext *avctx,
853
853
                            void *data, int *data_size,
854
 
                            uint8_t *buf, int buf_size)
 
854
                            const uint8_t *buf, int buf_size)
855
855
{
856
856
    SonicContext *s = avctx->priv_data;
857
857
    GetBitContext gb;
926
926
 
927
927
    // internal -> short
928
928
    for (i = 0; i < s->frame_size; i++)
929
 
    {
930
 
        if (s->int_samples[i] > 32767)
931
 
            samples[i] = 32767;
932
 
        else if (s->int_samples[i] < -32768)
933
 
            samples[i] = -32768;
934
 
        else
935
 
            samples[i] = s->int_samples[i];
936
 
    }
 
929
        samples[i] = av_clip_int16(s->int_samples[i]);
937
930
 
938
931
    align_get_bits(&gb);
939
932
 
953
946
    sonic_encode_frame,
954
947
    sonic_encode_close,
955
948
    NULL,
 
949
    .long_name = "Sonic",
956
950
};
957
951
 
958
952
AVCodec sonic_ls_encoder = {
964
958
    sonic_encode_frame,
965
959
    sonic_encode_close,
966
960
    NULL,
 
961
    .long_name = "Sonic lossless",
967
962
};
968
963
#endif
969
964
 
977
972
    NULL,
978
973
    sonic_decode_close,
979
974
    sonic_decode_frame,
 
975
    .long_name = "Sonic",
980
976
};
981
977
#endif