Statistics
| Branch: | Revision:

ffmpeg / libavcodec / amr.c @ 414425e0

History | View | Annotate | Download (17.9 KB)

1
/*
2
 * AMR Audio decoder stub
3
 * Copyright (c) 2003 the ffmpeg project
4
 *
5
 * This file is part of FFmpeg.
6
 *
7
 * FFmpeg is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * FFmpeg is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with FFmpeg; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
 */
21

    
22
 /** @file
23
 * Adaptive Multi-Rate (AMR) Audio decoder stub.
24
 *
25
 * This code implements both an AMR-NarrowBand (AMR-NB) and an AMR-WideBand
26
 * (AMR-WB) audio encoder/decoder through external reference code from
27
 * http://www.3gpp.org/. The license of the code from 3gpp is unclear so you
28
 * have to download the code separately. Two versions exists: One fixed-point
29
 * and one with floats. For some reason the float-encoder is significant faster
30
 * at least on a P4 1.5GHz (0.9s instead of 9.9s on a 30s audio clip at MR102).
31
 * Both float and fixed point are supported for AMR-NB, but only float for
32
 * AMR-WB.
33
 *
34
 * \section AMR-NB
35
 *
36
 * \subsection Float
37
 * The float version (default) can be downloaded from:
38
 * http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-610.zip
39
 * Extract the source into \c "ffmpeg/libavcodec/amr_float".
40
 * Enable it by passing \c "--enable-amr-nb" to \c "./configure".
41
 *
42
 * \subsection Fixed-point
43
 * The fixed-point (TS26.073) can be downloaded from:
44
 * http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-510.zip.
45
 * Extract the source into \c "ffmpeg/libavcodec/amr".
46
 * Enable it by passing \c "--enable-amr-nb-fixed" to \c "./configure".
47
 *
48
 * \subsection Specification
49
 * The specification for AMR-NB can be found in TS 26.071
50
 * (http://www.3gpp.org/ftp/Specs/html-info/26071.htm) and some other
51
 * info at http://www.3gpp.org/ftp/Specs/html-info/26-series.htm.
52
 *
53
 * \section AMR-WB
54
 * \subsection Float
55
 * The reference code can be downloaded from:
56
 * http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-600.zip
57
 * It should be extracted to \c "ffmpeg/libavcodec/amrwb_float".
58
 * Enable it by passing \c "--enable-amr-wb" to \c "./configure".
59
 *
60
 * \subsection Fixed-point
61
 * If someone wants to use the fixed point version it can be downloaded from:
62
 * http://www.3gpp.org/ftp/Specs/archive/26_series/26.173/26173-571.zip.
63
 *
64
 * \subsection Specification
65
 * The specification for AMR-WB can be found in TS 26.171
66
 * (http://www.3gpp.org/ftp/Specs/html-info/26171.htm) and some other
67
 * info at http://www.3gpp.org/ftp/Specs/html-info/26-series.htm.
68
 *
69
 */
70

    
71
#include "avcodec.h"
72

    
73
#ifdef CONFIG_AMR_NB_FIXED
74

    
75
#define MMS_IO
76

    
77
#include "amr/sp_dec.h"
78
#include "amr/d_homing.h"
79
#include "amr/typedef.h"
80
#include "amr/sp_enc.h"
81
#include "amr/sid_sync.h"
82
#include "amr/e_homing.h"
83

    
84
#else
85
#include "amr_float/interf_dec.h"
86
#include "amr_float/interf_enc.h"
87
#endif
88

    
89
static const char *nb_bitrate_unsupported =
90
    "bitrate not supported: use one of 4.75k, 5.15k, 5.9k, 6.7k, 7.4k, 7.95k, 10.2k or 12.2k\n";
91
static const char *wb_bitrate_unsupported =
92
    "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, 18.25k, 19.85k, 23.05k, or 23.85k\n";
93

    
94
/* Common code for fixed and float version*/
95
typedef struct AMR_bitrates
96
{
97
    int rate;
98
    enum Mode mode;
99
} AMR_bitrates;
100

    
101
/* Match desired bitrate */
102
static int getBitrateMode(int bitrate)
103
{
104
    /* make the correspondance between bitrate and mode */
105
    AMR_bitrates rates[]={ {4750,MR475},
106
                           {5150,MR515},
107
                           {5900,MR59},
108
                           {6700,MR67},
109
                           {7400,MR74},
110
                           {7950,MR795},
111
                           {10200,MR102},
112
                           {12200,MR122},
113
                         };
114
    int i;
115

    
116
    for(i=0;i<8;i++)
117
    {
118
        if(rates[i].rate==bitrate)
119
        {
120
            return(rates[i].mode);
121
        }
122
    }
123
    /* no bitrate matching, return an error */
124
    return -1;
125
}
126

    
127
static void amr_decode_fix_avctx(AVCodecContext * avctx)
128
{
129
    const int is_amr_wb = 1 + (avctx->codec_id == CODEC_ID_AMR_WB);
130

    
131
    if(avctx->sample_rate == 0)
132
    {
133
        avctx->sample_rate = 8000 * is_amr_wb;
134
    }
135

    
136
    if(avctx->channels == 0)
137
    {
138
        avctx->channels = 1;
139
    }
140

    
141
    avctx->frame_size = 160 * is_amr_wb;
142
}
143

    
144
#ifdef CONFIG_AMR_NB_FIXED
145
/* fixed point version*/
146
/* frame size in serial bitstream file (frame type + serial stream + flags) */
147
#define SERIAL_FRAMESIZE (1+MAX_SERIAL_SIZE+5)
148

    
149
typedef struct AMRContext {
150
    int frameCount;
151
    Speech_Decode_FrameState *speech_decoder_state;
152
    enum RXFrameType rx_type;
153
    enum Mode mode;
154
    Word16 reset_flag;
155
    Word16 reset_flag_old;
156

    
157
    int enc_bitrate;
158
    Speech_Encode_FrameState *enstate;
159
    sid_syncState *sidstate;
160
    enum TXFrameType tx_frametype;
161
} AMRContext;
162

    
163
static int amr_nb_decode_init(AVCodecContext * avctx)
164
{
165
    AMRContext *s = avctx->priv_data;
166

    
167
    s->frameCount=0;
168
    s->speech_decoder_state=NULL;
169
    s->rx_type = (enum RXFrameType)0;
170
    s->mode= (enum Mode)0;
171
    s->reset_flag=0;
172
    s->reset_flag_old=1;
173

    
174
    if(Speech_Decode_Frame_init(&s->speech_decoder_state, "Decoder"))
175
    {
176
        av_log(avctx, AV_LOG_ERROR, "Speech_Decode_Frame_init error\n");
177
        return -1;
178
    }
179

    
180
    amr_decode_fix_avctx(avctx);
181

    
182
    if(avctx->channels > 1)
183
    {
184
        av_log(avctx, AV_LOG_ERROR, "amr_nb: multichannel decoding not supported\n");
185
        return -1;
186
    }
187

    
188
    return 0;
189
}
190

    
191
static int amr_nb_encode_init(AVCodecContext * avctx)
192
{
193
    AMRContext *s = avctx->priv_data;
194

    
195
    s->frameCount=0;
196
    s->speech_decoder_state=NULL;
197
    s->rx_type = (enum RXFrameType)0;
198
    s->mode= (enum Mode)0;
199
    s->reset_flag=0;
200
    s->reset_flag_old=1;
201

    
202
    if(avctx->sample_rate!=8000)
203
    {
204
        av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n");
205
        return -1;
206
    }
207

    
208
    if(avctx->channels!=1)
209
    {
210
        av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
211
        return -1;
212
    }
213

    
214
    avctx->frame_size=160;
215
    avctx->coded_frame= avcodec_alloc_frame();
216

    
217
    if(Speech_Encode_Frame_init(&s->enstate, 0, "encoder") || sid_sync_init (&s->sidstate))
218
    {
219
        av_log(avctx, AV_LOG_ERROR, "Speech_Encode_Frame_init error\n");
220
        return -1;
221
    }
222

    
223
    if((s->enc_bitrate=getBitrateMode(avctx->bit_rate))<0)
224
    {
225
        av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported);
226
        return -1;
227
    }
228

    
229
    return 0;
230
}
231

    
232
static int amr_nb_encode_close(AVCodecContext * avctx)
233
{
234
    AMRContext *s = avctx->priv_data;
235

    
236
    Speech_Encode_Frame_exit(&s->enstate);
237
    sid_sync_exit (&s->sidstate);
238
    av_freep(&avctx->coded_frame);
239
    return 0;
240
}
241

    
242
static int amr_nb_decode_close(AVCodecContext * avctx)
243
{
244
    AMRContext *s = avctx->priv_data;
245

    
246
    Speech_Decode_Frame_exit(&s->speech_decoder_state);
247
    return 0;
248
}
249

    
250
static int amr_nb_decode_frame(AVCodecContext * avctx,
251
            void *data, int *data_size,
252
            uint8_t * buf, int buf_size)
253
{
254
    AMRContext *s = avctx->priv_data;
255
    uint8_t*amrData=buf;
256
    int offset=0;
257
    UWord8 toc, q, ft;
258
    Word16 serial[SERIAL_FRAMESIZE];   /* coded bits */
259
    Word16 *synth;
260
    UWord8 *packed_bits;
261
    static Word16 packed_size[16] = {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0};
262
    int i;
263

    
264
    //printf("amr_decode_frame data_size=%i buf=0x%X buf_size=%d frameCount=%d!!\n",*data_size,buf,buf_size,s->frameCount);
265

    
266
    synth=data;
267

    
268
    toc=amrData[offset];
269
    /* read rest of the frame based on ToC byte */
270
    q  = (toc >> 2) & 0x01;
271
    ft = (toc >> 3) & 0x0F;
272

    
273
    //printf("offset=%d, packet_size=%d amrData= 0x%X %X %X %X\n",offset,packed_size[ft],amrData[offset],amrData[offset+1],amrData[offset+2],amrData[offset+3]);
274

    
275
    offset++;
276

    
277
    packed_bits=amrData+offset;
278

    
279
    offset+=packed_size[ft];
280

    
281
    //Unsort and unpack bits
282
    s->rx_type = UnpackBits(q, ft, packed_bits, &s->mode, &serial[1]);
283

    
284
    //We have a new frame
285
    s->frameCount++;
286

    
287
    if (s->rx_type == RX_NO_DATA)
288
    {
289
        s->mode = s->speech_decoder_state->prev_mode;
290
    }
291
    else {
292
        s->speech_decoder_state->prev_mode = s->mode;
293
    }
294

    
295
    /* if homed: check if this frame is another homing frame */
296
    if (s->reset_flag_old == 1)
297
    {
298
        /* only check until end of first subframe */
299
        s->reset_flag = decoder_homing_frame_test_first(&serial[1], s->mode);
300
    }
301
    /* produce encoder homing frame if homed & input=decoder homing frame */
302
    if ((s->reset_flag != 0) && (s->reset_flag_old != 0))
303
    {
304
        for (i = 0; i < L_FRAME; i++)
305
        {
306
            synth[i] = EHF_MASK;
307
        }
308
    }
309
    else
310
    {
311
        /* decode frame */
312
        Speech_Decode_Frame(s->speech_decoder_state, s->mode, &serial[1], s->rx_type, synth);
313
    }
314

    
315
    //Each AMR-frame results in 160 16-bit samples
316
    *data_size=160*2;
317

    
318
    /* if not homed: check whether current frame is a homing frame */
319
    if (s->reset_flag_old == 0)
320
    {
321
        /* check whole frame */
322
        s->reset_flag = decoder_homing_frame_test(&serial[1], s->mode);
323
    }
324
    /* reset decoder if current frame is a homing frame */
325
    if (s->reset_flag != 0)
326
    {
327
        Speech_Decode_Frame_reset(s->speech_decoder_state);
328
    }
329
    s->reset_flag_old = s->reset_flag;
330

    
331
    return offset;
332
}
333

    
334

    
335
static int amr_nb_encode_frame(AVCodecContext *avctx,
336
                            unsigned char *frame/*out*/, int buf_size, void *data/*in*/)
337
{
338
    short serial_data[250] = {0};
339
    AMRContext *s = avctx->priv_data;
340
    int written;
341

    
342
    s->reset_flag = encoder_homing_frame_test(data);
343

    
344
    Speech_Encode_Frame(s->enstate, s->enc_bitrate, data, &serial_data[1], &s->mode);
345

    
346
    /* add frame type and mode */
347
    sid_sync (s->sidstate, s->mode, &s->tx_frametype);
348

    
349
    written = PackBits(s->mode, s->enc_bitrate, s->tx_frametype, &serial_data[1], frame);
350

    
351
    if (s->reset_flag != 0)
352
    {
353
        Speech_Encode_Frame_reset(s->enstate);
354
        sid_sync_reset(s->sidstate);
355
    }
356
    return written;
357
}
358

    
359

    
360
#elif defined(CONFIG_AMR_NB) /* Float point version*/
361

    
362
typedef struct AMRContext {
363
    int frameCount;
364
    void * decState;
365
    int *enstate;
366
    int enc_bitrate;
367
} AMRContext;
368

    
369
static int amr_nb_decode_init(AVCodecContext * avctx)
370
{
371
    AMRContext *s = avctx->priv_data;
372

    
373
    s->frameCount=0;
374
    s->decState=Decoder_Interface_init();
375
    if(!s->decState)
376
    {
377
        av_log(avctx, AV_LOG_ERROR, "Decoder_Interface_init error\r\n");
378
        return -1;
379
    }
380

    
381
    amr_decode_fix_avctx(avctx);
382

    
383
    if(avctx->channels > 1)
384
    {
385
        av_log(avctx, AV_LOG_ERROR, "amr_nb: multichannel decoding not supported\n");
386
        return -1;
387
    }
388

    
389
    return 0;
390
}
391

    
392
static int amr_nb_encode_init(AVCodecContext * avctx)
393
{
394
    AMRContext *s = avctx->priv_data;
395

    
396
    s->frameCount=0;
397

    
398
    if(avctx->sample_rate!=8000)
399
    {
400
        av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n");
401
        return -1;
402
    }
403

    
404
    if(avctx->channels!=1)
405
    {
406
        av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
407
        return -1;
408
    }
409

    
410
    avctx->frame_size=160;
411
    avctx->coded_frame= avcodec_alloc_frame();
412

    
413
    s->enstate=Encoder_Interface_init(0);
414
    if(!s->enstate)
415
    {
416
        av_log(avctx, AV_LOG_ERROR, "Encoder_Interface_init error\n");
417
        return -1;
418
    }
419

    
420
    if((s->enc_bitrate=getBitrateMode(avctx->bit_rate))<0)
421
    {
422
        av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported);
423
        return -1;
424
    }
425

    
426
    return 0;
427
}
428

    
429
static int amr_nb_decode_close(AVCodecContext * avctx)
430
{
431
    AMRContext *s = avctx->priv_data;
432

    
433
    Decoder_Interface_exit(s->decState);
434
    return 0;
435
}
436

    
437
static int amr_nb_encode_close(AVCodecContext * avctx)
438
{
439
    AMRContext *s = avctx->priv_data;
440

    
441
    Encoder_Interface_exit(s->enstate);
442
    av_freep(&avctx->coded_frame);
443
    return 0;
444
}
445

    
446
static int amr_nb_decode_frame(AVCodecContext * avctx,
447
            void *data, int *data_size,
448
            uint8_t * buf, int buf_size)
449
{
450
    AMRContext *s = avctx->priv_data;
451
    uint8_t*amrData=buf;
452
    static short block_size[16]={ 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 };
453
    enum Mode dec_mode;
454
    int packet_size;
455

    
456
    /* av_log(NULL,AV_LOG_DEBUG,"amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n",buf,buf_size,s->frameCount); */
457

    
458
    dec_mode = (buf[0] >> 3) & 0x000F;
459
    packet_size = block_size[dec_mode]+1;
460

    
461
    if(packet_size > buf_size) {
462
        av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n", buf_size, packet_size);
463
        return -1;
464
    }
465

    
466
    s->frameCount++;
467
    /* av_log(NULL,AV_LOG_DEBUG,"packet_size=%d amrData= 0x%X %X %X %X\n",packet_size,amrData[0],amrData[1],amrData[2],amrData[3]); */
468
    /* call decoder */
469
    Decoder_Interface_Decode(s->decState, amrData, data, 0);
470
    *data_size=160*2;
471

    
472
    return packet_size;
473
}
474

    
475
static int amr_nb_encode_frame(AVCodecContext *avctx,
476
                            unsigned char *frame/*out*/, int buf_size, void *data/*in*/)
477
{
478
    AMRContext *s = avctx->priv_data;
479
    int written;
480

    
481
    if((s->enc_bitrate=getBitrateMode(avctx->bit_rate))<0)
482
    {
483
        av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported);
484
        return -1;
485
    }
486

    
487
    written = Encoder_Interface_Encode(s->enstate,
488
        s->enc_bitrate,
489
        data,
490
        frame,
491
        0);
492
    /* av_log(NULL,AV_LOG_DEBUG,"amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n",written, s->enc_bitrate, frame[0] ); */
493

    
494
    return written;
495
}
496

    
497
#endif
498

    
499
#if defined(CONFIG_AMR_NB) || defined(CONFIG_AMR_NB_FIXED)
500

    
501
AVCodec amr_nb_decoder =
502
{
503
    "amr_nb",
504
    CODEC_TYPE_AUDIO,
505
    CODEC_ID_AMR_NB,
506
    sizeof(AMRContext),
507
    amr_nb_decode_init,
508
    NULL,
509
    amr_nb_decode_close,
510
    amr_nb_decode_frame,
511
};
512

    
513
AVCodec amr_nb_encoder =
514
{
515
    "amr_nb",
516
    CODEC_TYPE_AUDIO,
517
    CODEC_ID_AMR_NB,
518
    sizeof(AMRContext),
519
    amr_nb_encode_init,
520
    amr_nb_encode_frame,
521
    amr_nb_encode_close,
522
    NULL,
523
};
524

    
525
#endif
526

    
527
/* -----------AMR wideband ------------*/
528
#ifdef CONFIG_AMR_WB
529

    
530
#ifdef _TYPEDEF_H
531
//To avoid duplicate typedefs from typdef in amr-nb
532
#define typedef_h
533
#endif
534

    
535
#include "amrwb_float/enc_if.h"
536
#include "amrwb_float/dec_if.h"
537

    
538
/* Common code for fixed and float version*/
539
typedef struct AMRWB_bitrates
540
{
541
    int rate;
542
    int mode;
543
} AMRWB_bitrates;
544

    
545
static int getWBBitrateMode(int bitrate)
546
{
547
    /* make the correspondance between bitrate and mode */
548
    AMRWB_bitrates rates[]={ {6600,0},
549
                           {8850,1},
550
                           {12650,2},
551
                           {14250,3},
552
                           {15850,4},
553
                           {18250,5},
554
                           {19850,6},
555
                           {23050,7},
556
                           {23850,8},
557
                         };
558
    int i;
559

    
560
    for(i=0;i<9;i++)
561
    {
562
        if(rates[i].rate==bitrate)
563
        {
564
            return(rates[i].mode);
565
        }
566
    }
567
    /* no bitrate matching, return an error */
568
    return -1;
569
}
570

    
571

    
572
typedef struct AMRWBContext {
573
    int frameCount;
574
    void *state;
575
    int mode;
576
    Word16 allow_dtx;
577
} AMRWBContext;
578

    
579
static int amr_wb_encode_init(AVCodecContext * avctx)
580
{
581
    AMRWBContext *s = avctx->priv_data;
582

    
583
    s->frameCount=0;
584

    
585
    if(avctx->sample_rate!=16000)
586
    {
587
        av_log(avctx, AV_LOG_ERROR, "Only 16000Hz sample rate supported\n");
588
        return -1;
589
    }
590

    
591
    if(avctx->channels!=1)
592
    {
593
        av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
594
        return -1;
595
    }
596

    
597
    if((s->mode=getWBBitrateMode(avctx->bit_rate))<0)
598
    {
599
        av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported);
600
        return -1;
601
    }
602

    
603
    avctx->frame_size=320;
604
    avctx->coded_frame= avcodec_alloc_frame();
605

    
606
    s->state = E_IF_init();
607
    s->allow_dtx=0;
608

    
609
    return 0;
610
}
611

    
612
static int amr_wb_encode_close(AVCodecContext * avctx)
613
{
614
    AMRWBContext *s = avctx->priv_data;
615

    
616
    E_IF_exit(s->state);
617
    av_freep(&avctx->coded_frame);
618
    s->frameCount++;
619
    return 0;
620
}
621

    
622
static int amr_wb_encode_frame(AVCodecContext *avctx,
623
                            unsigned char *frame/*out*/, int buf_size, void *data/*in*/)
624
{
625
    AMRWBContext *s = avctx->priv_data;
626
    int size;
627

    
628
    if((s->mode=getWBBitrateMode(avctx->bit_rate))<0)
629
    {
630
        av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported);
631
        return -1;
632
    }
633
    size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx);
634
    return size;
635
}
636

    
637
static int amr_wb_decode_init(AVCodecContext * avctx)
638
{
639
    AMRWBContext *s = avctx->priv_data;
640

    
641
    s->frameCount=0;
642
    s->state = D_IF_init();
643

    
644
    amr_decode_fix_avctx(avctx);
645

    
646
    if(avctx->channels > 1)
647
    {
648
        av_log(avctx, AV_LOG_ERROR, "amr_wb: multichannel decoding not supported\n");
649
        return -1;
650
    }
651

    
652
    return 0;
653
}
654

    
655
extern const UWord8 block_size[];
656

    
657
static int amr_wb_decode_frame(AVCodecContext * avctx,
658
            void *data, int *data_size,
659
            uint8_t * buf, int buf_size)
660
{
661
    AMRWBContext *s = avctx->priv_data;
662
    uint8_t*amrData=buf;
663
    int mode;
664
    int packet_size;
665

    
666
    if(buf_size==0) {
667
        /* nothing to do */
668
        return 0;
669
    }
670

    
671
    mode = (amrData[0] >> 3) & 0x000F;
672
    packet_size = block_size[mode];
673

    
674
    if(packet_size > buf_size) {
675
        av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n", buf_size, packet_size+1);
676
        return -1;
677
    }
678

    
679
    s->frameCount++;
680
    D_IF_decode( s->state, amrData, data, _good_frame);
681
    *data_size=320*2;
682
    return packet_size;
683
}
684

    
685
static int amr_wb_decode_close(AVCodecContext * avctx)
686
{
687
    AMRWBContext *s = avctx->priv_data;
688

    
689
    D_IF_exit(s->state);
690
    return 0;
691
}
692

    
693
AVCodec amr_wb_decoder =
694
{
695
    "amr_wb",
696
    CODEC_TYPE_AUDIO,
697
    CODEC_ID_AMR_WB,
698
    sizeof(AMRWBContext),
699
    amr_wb_decode_init,
700
    NULL,
701
    amr_wb_decode_close,
702
    amr_wb_decode_frame,
703
};
704

    
705
AVCodec amr_wb_encoder =
706
{
707
    "amr_wb",
708
    CODEC_TYPE_AUDIO,
709
    CODEC_ID_AMR_WB,
710
    sizeof(AMRWBContext),
711
    amr_wb_encode_init,
712
    amr_wb_encode_frame,
713
    amr_wb_encode_close,
714
    NULL,
715
};
716

    
717
#endif //CONFIG_AMR_WB