~ubuntu-branches/ubuntu/oneiric/libav/oneiric

« back to all changes in this revision

Viewing changes to libavcodec/h264.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2011-04-30 14:27:42 UTC
  • mfrom: (1.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110430142742-quvblxk1tj6adlh5
Tags: 4:0.7~b1-1ubuntu1
* Merge from debian. Remaining changes:
  - don't build against libfaad, libdirac, librtmp and libopenjpeg
    (all in universe)
  - explicitly --enable-pic on powerpc, cf. LP #654666
  - different arm configure bits that should probably better be
    merged into debian
* Cherry-picked from git: 
  - install doc/APIChanges and refer to them in NEWS.Debian (Closes: #623682)
  - don't try to install non-existing documentation, fixes FTBFS on powerpc

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
3
3
 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
4
4
 *
5
 
 * This file is part of FFmpeg.
 
5
 * This file is part of Libav.
6
6
 *
7
 
 * FFmpeg is free software; you can redistribute it and/or
 
7
 * Libav is free software; you can redistribute it and/or
8
8
 * modify it under the terms of the GNU Lesser General Public
9
9
 * License as published by the Free Software Foundation; either
10
10
 * version 2.1 of the License, or (at your option) any later version.
11
11
 *
12
 
 * FFmpeg is distributed in the hope that it will be useful,
 
12
 * Libav is distributed in the hope that it will be useful,
13
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
15
 * Lesser General Public License for more details.
16
16
 *
17
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
 
18
 * License along with Libav; if not, write to the Free Software
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
20
 */
21
21
 
39
39
#define interlaced_dct interlaced_dct_is_a_bad_name
40
40
#define mb_intra mb_intra_is_not_initialized_see_mb_type
41
41
 
42
 
#define LUMA_DC_BLOCK_INDEX   25
43
 
#define CHROMA_DC_BLOCK_INDEX 26
 
42
#define LUMA_DC_BLOCK_INDEX   24
 
43
#define CHROMA_DC_BLOCK_INDEX 25
44
44
 
45
45
#define CHROMA_DC_COEFF_TOKEN_VLC_BITS 8
46
46
#define COEFF_TOKEN_VLC_BITS           8
209
209
    int bit_depth_luma;                ///< bit_depth_luma_minus8 + 8
210
210
    int bit_depth_chroma;              ///< bit_depth_chroma_minus8 + 8
211
211
    int residual_color_transform_flag; ///< residual_colour_transform_flag
 
212
    int constraint_set_flags;          ///< constraint_set[0-3]_flag
212
213
}SPS;
213
214
 
214
215
/**
406
407
    GetBitContext *inter_gb_ptr;
407
408
 
408
409
    DECLARE_ALIGNED(16, DCTELEM, mb)[16*24];
 
410
    DECLARE_ALIGNED(16, DCTELEM, mb_luma_dc)[16];
409
411
    DCTELEM mb_padding[256];        ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb
410
412
 
411
413
    /**
464
466
     */
465
467
    int is_avc; ///< this flag is != 0 if codec is avc1
466
468
    int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4)
 
469
    int got_first; ///< this flag is != 0 if we've parsed a frame
467
470
 
468
471
    SPS *sps_buffers[MAX_SPS_COUNT];
469
472
    PPS *pps_buffers[MAX_PPS_COUNT];
599
602
 
600
603
extern const uint8_t ff_h264_chroma_qp[52];
601
604
 
602
 
void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp);
603
 
 
604
 
void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc);
605
 
 
606
605
/**
607
606
 * Decode SEI
608
607
 */
614
613
int ff_h264_decode_seq_parameter_set(H264Context *h);
615
614
 
616
615
/**
 
616
 * compute profile from sps
 
617
 */
 
618
int ff_h264_get_profile(SPS *sps);
 
619
 
 
620
/**
617
621
 * Decode PPS
618
622
 */
619
623
int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length);
620
624
 
621
625
/**
622
 
 * Decodes a network abstraction layer unit.
 
626
 * Decode a network abstraction layer unit.
623
627
 * @param consumed is the number of bytes used as input
624
628
 * @param length is the length of the array
625
629
 * @param dst_length is the number of decoded bytes FIXME here or a decode rbsp tailing?
628
632
const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length);
629
633
 
630
634
/**
631
 
 * identifies the exact end of the bitstream
632
 
 * @return the length of the trailing, or 0 if damaged
633
 
 */
634
 
int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src);
635
 
 
636
 
/**
637
 
 * frees any data that may have been allocated in the H264 context like SPS, PPS etc.
 
635
 * Free any data that may have been allocated in the H264 context like SPS, PPS etc.
638
636
 */
639
637
av_cold void ff_h264_free_context(H264Context *h);
640
638
 
641
639
/**
642
 
 * reconstructs bitstream slice_type.
 
640
 * Reconstruct bitstream slice_type.
643
641
 */
644
642
int ff_h264_get_slice_type(const H264Context *h);
645
643
 
646
644
/**
647
 
 * allocates tables.
 
645
 * Allocate tables.
648
646
 * needs width/height
649
647
 */
650
648
int ff_h264_alloc_tables(H264Context *h);
651
649
 
652
650
/**
653
 
 * fills the default_ref_list.
 
651
 * Fill the default_ref_list.
654
652
 */
655
653
int ff_h264_fill_default_ref_list(H264Context *h);
656
654
 
659
657
void ff_h264_remove_all_refs(H264Context *h);
660
658
 
661
659
/**
662
 
 * Executes the reference picture marking (memory management control operations).
 
660
 * Execute the reference picture marking (memory management control operations).
663
661
 */
664
662
int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count);
665
663
 
666
664
int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb);
667
665
 
 
666
void ff_generate_sliding_window_mmcos(H264Context *h);
 
667
 
668
668
 
669
669
/**
670
 
 * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
 
670
 * Check if the top & left blocks are available if needed & change the dc mode so it only uses the available blocks.
671
671
 */
672
672
int ff_h264_check_intra4x4_pred_mode(H264Context *h);
673
673
 
674
674
/**
675
 
 * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
 
675
 * Check if the top & left blocks are available if needed & change the dc mode so it only uses the available blocks.
676
676
 */
677
677
int ff_h264_check_intra_pred_mode(H264Context *h, int mode);
678
678
 
679
679
void ff_h264_write_back_intra_pred_mode(H264Context *h);
680
680
void ff_h264_hl_decode_mb(H264Context *h);
681
681
int ff_h264_frame_start(H264Context *h);
 
682
int ff_h264_decode_extradata(H264Context *h);
682
683
av_cold int ff_h264_decode_init(AVCodecContext *avctx);
683
684
av_cold int ff_h264_decode_end(AVCodecContext *avctx);
684
685
av_cold void ff_h264_decode_init_vlc(void);
685
686
 
686
687
/**
687
 
 * decodes a macroblock
 
688
 * Decode a macroblock
688
689
 * @return 0 if OK, AC_ERROR / DC_ERROR / MV_ERROR if an error is noticed
689
690
 */
690
691
int ff_h264_decode_mb_cavlc(H264Context *h);
691
692
 
692
693
/**
693
 
 * decodes a CABAC coded macroblock
 
694
 * Decode a CABAC coded macroblock
694
695
 * @return 0 if OK, AC_ERROR / DC_ERROR / MV_ERROR if an error is noticed
695
696
 */
696
697
int ff_h264_decode_mb_cabac(H264Context *h);
721
722
 / / /
722
723
o-o o-o
723
724
*/
 
725
 
 
726
/* Scan8 organization:
 
727
 *   0 1 2 3 4 5 6 7
 
728
 * 0   u u y y y y y
 
729
 * 1 u U U y Y Y Y Y
 
730
 * 2 u U U y Y Y Y Y
 
731
 * 3   v v y Y Y Y Y
 
732
 * 4 v V V y Y Y Y Y
 
733
 * 5 v V V   DYDUDV
 
734
 * DY/DU/DV are for luma/chroma DC.
 
735
 */
 
736
 
724
737
//This table must be here because scan8[constant] must be known at compiletime
725
 
static const uint8_t scan8[16 + 2*4]={
 
738
static const uint8_t scan8[16 + 2*4 + 3]={
726
739
 4+1*8, 5+1*8, 4+2*8, 5+2*8,
727
740
 6+1*8, 7+1*8, 6+2*8, 7+2*8,
728
741
 4+3*8, 5+3*8, 4+4*8, 5+4*8,
731
744
 1+2*8, 2+2*8,
732
745
 1+4*8, 2+4*8,
733
746
 1+5*8, 2+5*8,
 
747
 4+5*8, 5+5*8, 6+5*8
734
748
};
735
749
 
736
750
static av_always_inline uint32_t pack16to32(int a, int b){
1253
1267
/**
1254
1268
 * decodes a P_SKIP or B_SKIP macroblock
1255
1269
 */
1256
 
static void decode_mb_skip(H264Context *h){
 
1270
static void av_unused decode_mb_skip(H264Context *h){
1257
1271
    MpegEncContext * const s = &h->s;
1258
1272
    const int mb_xy= h->mb_xy;
1259
1273
    int mb_type=0;