00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00027 #ifndef AVCODEC_DVDATA_H
00028 #define AVCODEC_DVDATA_H
00029
00030 #include "avcodec.h"
00031 #include "dsputil.h"
00032 #include "get_bits.h"
00033 #include "dv_profile.h"
00034
00035 typedef struct DVVideoContext {
00036 const DVprofile *sys;
00037 AVFrame picture;
00038 AVCodecContext *avctx;
00039 uint8_t *buf;
00040
00041 uint8_t dv_zigzag[2][64];
00042
00043 void (*get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size);
00044 void (*fdct[2])(DCTELEM *block);
00045 void (*idct_put[2])(uint8_t *dest, int line_size, DCTELEM *block);
00046 me_cmp_func ildct_cmp;
00047 } DVVideoContext;
00048
00049 enum dv_section_type {
00050 dv_sect_header = 0x1f,
00051 dv_sect_subcode = 0x3f,
00052 dv_sect_vaux = 0x56,
00053 dv_sect_audio = 0x76,
00054 dv_sect_video = 0x96,
00055 };
00056
00057 enum dv_pack_type {
00058 dv_header525 = 0x3f,
00059 dv_header625 = 0xbf,
00060 dv_timecode = 0x13,
00061 dv_audio_source = 0x50,
00062 dv_audio_control = 0x51,
00063 dv_audio_recdate = 0x52,
00064 dv_audio_rectime = 0x53,
00065 dv_video_source = 0x60,
00066 dv_video_control = 0x61,
00067 dv_video_recdate = 0x62,
00068 dv_video_rectime = 0x63,
00069 dv_unknown_pack = 0xff,
00070 };
00071
00072 extern const uint8_t ff_dv_quant_shifts[22][4];
00073 extern const uint8_t ff_dv_quant_offset[4];
00074
00075 extern const int ff_dv_iweight_88[64];
00076 extern const int ff_dv_iweight_248[64];
00077 extern const int ff_dv_iweight_1080_y[64];
00078 extern const int ff_dv_iweight_1080_c[64];
00079 extern const int ff_dv_iweight_720_y[64];
00080 extern const int ff_dv_iweight_720_c[64];
00081
00082 #define DV_PROFILE_IS_HD(p) ((p)->video_stype & 0x10)
00083 #define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1))
00084 #define DV_PROFILE_IS_720p50(p) (((p)->video_stype == 0x18) && ((p)->dsf == 1))
00085
00089 #define DV_MAX_FRAME_SIZE 576000
00090
00094 #define DV_MAX_BPM 8
00095
00096 #define TEX_VLC_BITS 9
00097
00098 extern RL_VLC_ELEM ff_dv_rl_vlc[1184];
00099
00100 int ff_dv_init_dynamic_tables(const DVprofile *d);
00101 int ff_dvvideo_init(AVCodecContext *avctx);
00102
00103 static inline int dv_work_pool_size(const DVprofile *d)
00104 {
00105 int size = d->n_difchan*d->difseg_size*27;
00106 if (DV_PROFILE_IS_1080i50(d))
00107 size -= 3*27;
00108 if (DV_PROFILE_IS_720p50(d))
00109 size -= 4*27;
00110 return size;
00111 }
00112
00113 static inline void dv_calculate_mb_xy(DVVideoContext *s, DVwork_chunk *work_chunk, int m, int *mb_x, int *mb_y)
00114 {
00115 *mb_x = work_chunk->mb_coordinates[m] & 0xff;
00116 *mb_y = work_chunk->mb_coordinates[m] >> 8;
00117
00118
00119 if (s->sys->height == 720 && !(s->buf[1]&0x0C)) {
00120 *mb_y -= (*mb_y>17)?18:-72;
00121 }
00122 }
00123
00124 #endif