summaryrefslogtreecommitdiff
path: root/ffmpeg/libavcodec/h264.h
diff options
context:
space:
mode:
Diffstat (limited to 'ffmpeg/libavcodec/h264.h')
-rw-r--r--ffmpeg/libavcodec/h264.h88
1 files changed, 73 insertions, 15 deletions
diff --git a/ffmpeg/libavcodec/h264.h b/ffmpeg/libavcodec/h264.h
index f20401d..916f104 100644
--- a/ffmpeg/libavcodec/h264.h
+++ b/ffmpeg/libavcodec/h264.h
@@ -87,9 +87,9 @@
#define CABAC(h) h->pps.cabac
#endif
-#define CHROMA (h->sps.chroma_format_idc)
-#define CHROMA422 (h->sps.chroma_format_idc == 2)
-#define CHROMA444 (h->sps.chroma_format_idc == 3)
+#define CHROMA(h) (h->sps.chroma_format_idc)
+#define CHROMA422(h) (h->sps.chroma_format_idc == 2)
+#define CHROMA444(h) (h->sps.chroma_format_idc == 3)
#define EXTENDED_SAR 255
@@ -127,7 +127,8 @@ typedef enum {
SEI_TYPE_PIC_TIMING = 1, ///< picture timing
SEI_TYPE_USER_DATA_ITU_T_T35 = 4, ///< user data registered by ITU-T Recommendation T.35
SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data
- SEI_TYPE_RECOVERY_POINT = 6 ///< recovery point (frame # to decoder sync)
+ SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync)
+ SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement
} SEI_Type;
/**
@@ -146,6 +147,19 @@ typedef enum {
} SEI_PicStructType;
/**
+ * frame_packing_arrangement types
+ */
+typedef enum {
+ SEI_FPA_TYPE_CHECKERBOARD = 0,
+ SEI_FPA_TYPE_INTERLEAVE_COLUMN = 1,
+ SEI_FPA_TYPE_INTERLEAVE_ROW = 2,
+ SEI_FPA_TYPE_SIDE_BY_SIDE = 3,
+ SEI_FPA_TYPE_TOP_BOTTOM = 4,
+ SEI_FPA_TYPE_INTERLEAVE_TEMPORAL = 5,
+ SEI_FPA_TYPE_2D = 6,
+} SEI_FpaType;
+
+/**
* Sequence parameter set
*/
typedef struct SPS {
@@ -168,6 +182,8 @@ typedef struct SPS {
int mb_aff; ///< mb_adaptive_frame_field_flag
int direct_8x8_inference_flag;
int crop; ///< frame_cropping_flag
+
+ /* those 4 are already in luma samples */
unsigned int crop_left; ///< frame_cropping_rect_left_offset
unsigned int crop_right; ///< frame_cropping_rect_right_offset
unsigned int crop_top; ///< frame_cropping_rect_top_offset
@@ -231,6 +247,18 @@ typedef struct PPS {
} PPS;
/**
+ * Frame Packing Arrangement Type
+ */
+typedef struct FPA {
+ int frame_packing_arrangement_id;
+ int frame_packing_arrangement_cancel_flag; ///< is previous arrangement canceled, -1 if never received
+ SEI_FpaType frame_packing_arrangement_type;
+ int frame_packing_arrangement_repetition_period;
+ int content_interpretation_type;
+ int quincunx_sampling_flag;
+} FPA;
+
+/**
* Memory management control operation opcode.
*/
typedef enum MMCOOpcode {
@@ -276,8 +304,9 @@ typedef struct H264Context {
int qp_thresh; ///< QP threshold to skip loopfilter
+ /* coded dimensions -- 16 * mb w/h */
int width, height;
- int linesize, uvlinesize;
+ ptrdiff_t linesize, uvlinesize;
int chroma_x_shift, chroma_y_shift;
int qscale;
@@ -350,8 +379,8 @@ typedef struct H264Context {
uint32_t *mb2br_xy;
int b_stride; // FIXME use s->b4_stride
- int mb_linesize; ///< may be equal to s->linesize or s->linesize * 2, for mbaff
- int mb_uvlinesize;
+ ptrdiff_t mb_linesize; ///< may be equal to s->linesize or s->linesize * 2, for mbaff
+ ptrdiff_t mb_uvlinesize;
unsigned current_sps_id; ///< id of the current SPS
SPS sps; ///< current sps
@@ -588,6 +617,14 @@ typedef struct H264Context {
int prev_interlaced_frame;
/**
+ * frame_packing_arrangment SEI message
+ */
+ int sei_frame_packing_present;
+ int frame_packing_arrangement_type;
+ int content_interpretation_type;
+ int quincunx_subsampling;
+
+ /**
* Bit set of clock types for fields/frames in picture timing SEI message.
* For each found ct_type, appropriate bit is set (e.g., bit 1 for
* interlaced).
@@ -612,6 +649,14 @@ typedef struct H264Context {
* frames.
*/
int sei_recovery_frame_cnt;
+
+ /**
+ * Are the SEI recovery points looking valid.
+ */
+ int valid_recovery_point;
+
+ FPA sei_fpa;
+
/**
* recovery_frame is the frame_num at which the next frame should
* be fully constructed.
@@ -620,10 +665,18 @@ typedef struct H264Context {
*/
int recovery_frame;
- /**
- * Are the SEI recovery points looking valid.
- */
- int valid_recovery_point;
+/**
+ * We have seen an IDR, so all the following frames in coded order are correctly
+ * decodable.
+ */
+#define FRAME_RECOVERED_IDR (1 << 0)
+/**
+ * Sufficient number of frames have been decoded since a SEI recovery point,
+ * so all the following frames in presentation order are correct.
+ */
+#define FRAME_RECOVERED_SEI (1 << 1)
+
+ int frame_recovered; ///< Initial frame has been completely recovered
int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag
int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag
@@ -637,16 +690,12 @@ typedef struct H264Context {
int16_t slice_row[MAX_SLICES]; ///< to detect when MAX_SLICES is too low
- int sync; ///< did we had a keyframe or recovery point
-
uint8_t parse_history[4];
int parse_history_count;
int parse_last_mb;
uint8_t *edge_emu_buffer;
int16_t *dc_val_base;
- uint8_t *visualization_buffer[3]; ///< temporary buffer vor MV visualization
-
AVBufferPool *qscale_table_pool;
AVBufferPool *mb_type_pool;
AVBufferPool *motion_val_pool;
@@ -772,6 +821,12 @@ void ff_h264_filter_mb(H264Context *h, int mb_x, int mb_y,
*/
void ff_h264_reset_sei(H264Context *h);
+/**
+ * Get stereo_mode string from the h264 frame_packing_arrangement
+ * @param h H.264 context.
+ */
+const char* ff_h264_sei_stereo_mode(H264Context *h);
+
/*
* o-o o-o
* / / /
@@ -973,5 +1028,8 @@ static av_always_inline int get_dct8x8_allowed(H264Context *h)
}
void ff_h264_draw_horiz_band(H264Context *h, int y, int height);
+int ff_init_poc(H264Context *h, int pic_field_poc[2], int *pic_poc);
+int ff_pred_weight_table(H264Context *h);
+int ff_set_ref_count(H264Context *h);
#endif /* AVCODEC_H264_H */