#include "global.h"
#include "enc_statistics.h"
Go to the source code of this file.
Data Structures | |
struct | picture_stats |
struct | storable_picture |
definition a picture (field or frame) More... | |
struct | motion_params |
definition of motion parameters More... | |
struct | colocated_params |
definition a picture (field or frame) More... | |
struct | frame_store |
Frame Stores for Decoded Picture Buffer. More... | |
struct | decoded_picture_buffer |
Decoded Picture Buffer. More... | |
Defines | |
#define | MAX_LIST_SIZE 33 |
Typedefs | |
typedef struct picture_stats | PictureStats |
typedef struct storable_picture | StorablePicture |
typedef struct motion_params | MotionParams |
typedef struct colocated_params | ColocatedParams |
typedef struct frame_store | FrameStore |
typedef struct decoded_picture_buffer | DecodedPictureBuffer |
Functions | |
void | init_dpb (ImageParameters *p_Img, InputParameters *p_Inp, DecodedPictureBuffer *dpb) |
void | free_dpb (ImageParameters *p_Img, InputParameters *p_Inp, DecodedPictureBuffer *dpb) |
FrameStore * | alloc_frame_store (void) |
void | free_frame_store (ImageParameters *p_Img, InputParameters *p_Inp, FrameStore *f) |
StorablePicture * | alloc_storable_picture (ImageParameters *p_Img, InputParameters *p_Inp, PictureStructure type, int size_x, int size_y, int size_x_cr, int size_y_cr) |
void | free_storable_picture (ImageParameters *p_Img, InputParameters *p_Inp, StorablePicture *p) |
void | store_picture_in_dpb (ImageParameters *p_Img, InputParameters *p_Inp, StorablePicture *p, FrameFormat *output) |
void | replace_top_pic_with_frame (ImageParameters *p_Img, InputParameters *p_Inp, StorablePicture *p, FrameFormat *output) |
void | flush_dpb (ImageParameters *p_Img, InputParameters *p_Inp, FrameFormat *output) |
void | dpb_split_field (ImageParameters *p_Img, InputParameters *p_Inp, FrameStore *fs) |
void | dpb_combine_field (ImageParameters *p_Img, InputParameters *p_Inp, FrameStore *fs) |
void | dpb_combine_field_yuv (ImageParameters *p_Img, InputParameters *p_Inp, FrameStore *fs) |
void | init_lists (Slice *currSlice) |
void | reorder_ref_pic_list (Slice *currSlice, StorablePicture **list[6], char list_size[6], int cur_list) |
void | init_mbaff_lists (Slice *currSlice) |
void | alloc_ref_pic_list_reordering_buffer (Slice *currSlice) |
void | free_ref_pic_list_reordering_buffer (Slice *currSlice) |
void | fill_frame_num_gap (ImageParameters *p_Img, InputParameters *p_Inp, FrameFormat *output) |
ColocatedParams * | alloc_colocated (int size_x, int size_y, int mb_adaptive_frame_field_flag) |
void | free_colocated (ColocatedParams *p) |
void | compute_colocated (Slice *currSlice, ColocatedParams *p, StorablePicture **listX[6]) |
void | compute_colocated_JV (Slice *currSlice, ColocatedParams *p, StorablePicture **listX[6]) |
void | copy_storable_param_JV (ImageParameters *p_Img, int nplane, StorablePicture *d, StorablePicture *s) |
Definition in file mbuffer.h.
ColocatedParams* alloc_colocated | ( | int | size_x, | |
int | size_y, | |||
int | mb_adaptive_frame_field_flag | |||
) |
Allocate co-located memory.
size_x | horizontal luma size | |
size_y | vertical luma size | |
mb_adaptive_frame_field_flag | flag that indicates macroblock adaptive frame/field coding |
Definition at line 3628 of file mbuffer.c.
References alloc_motion_params(), and no_mem_exit().
Referenced by init_slice().
FrameStore* alloc_frame_store | ( | void | ) |
Allocate memory for decoded picture buffer frame stores and initialize with sane values.
Definition at line 303 of file mbuffer.c.
References frame_store::is_long_term, frame_store::is_orig_reference, frame_store::is_reference, frame_store::is_used, and no_mem_exit().
Referenced by idr_memory_management(), init_dpb(), and init_out_buffer().
void alloc_ref_pic_list_reordering_buffer | ( | Slice * | currSlice | ) |
Allocate memory for buffering of reference picture reordering commands.
Definition at line 3481 of file mbuffer.c.
References no_mem_exit(), and slice::slice_type.
Referenced by reorder_lists(), and wp_mcprec_reorder_lists().
StorablePicture* alloc_storable_picture | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp, | |||
PictureStructure | structure, | |||
int | size_x, | |||
int | size_y, | |||
int | size_x_cr, | |||
int | size_y_cr | |||
) |
Allocate memory for a stored picture.
p_Img | ImageParameters | |
p_Inp | InputParameters | |
structure | picture structure | |
size_x | horizontal luma size | |
size_y | vertical luma size | |
size_x_cr | horizontal chroma size | |
size_y_cr | vertical chroma size |
Definition at line 372 of file mbuffer.c.
References storable_picture::dec_imgUV, storable_picture::dec_imgY, get_mem2Dpel(), get_mem3D(), get_mem3Dpel(), get_mem4Dpel(), IMG_PAD_SIZE, storable_picture::imgUV, storable_picture::imgUV_sub, storable_picture::imgY, storable_picture::imgY_sub, storable_picture::JVmotion, storable_picture::mb_error_map, storable_picture::motion, no_mem_exit(), storable_picture::p_curr_img, storable_picture::p_curr_img_sub, storable_picture::p_dec_img, storable_picture::p_img, storable_picture::p_img_sub, and YUV400.
Referenced by dpb_combine_field_yuv(), dpb_split_field(), field_picture(), fill_frame_num_gap(), prepare_enc_frame_picture(), and write_unpaired_field().
void compute_colocated | ( | Slice * | currSlice, | |
ColocatedParams * | p, | |||
StorablePicture ** | listX[6] | |||
) |
Compute co-located motion info.
Assign frame buffers for field MBs Check whether we should use top or bottom field mvs. Depending on the assigned poc values.
Generate field MVs from Frame MVs
Do nothing if macroblock as field coded in MB-AFF
Use inference flag to remap mvs/references Frame with field co-located
Use inference flag to remap mvs/references
Definition at line 3709 of file mbuffer.c.
References slice::direct_spatial_mv_pred_flag, pic_motion_params::field_frame, storable_picture::motion, pic_motion_params::mv, motion_params::mv, pic_motion_params::ref_id, pic_motion_params::ref_idx, motion_params::ref_idx, and motion_params::ref_pic_id.
Referenced by init_slice().
void compute_colocated_JV | ( | Slice * | currSlice, | |
ColocatedParams * | p, | |||
StorablePicture ** | listX[6] | |||
) |
Compute co-located motion info for 4:4:4 Independent mode.
Assign frame buffers for field MBs Check whether we should use top or bottom field mvs. Depending on the assigned poc values.
Generate field MVs from Frame MVs
Do nothing if macroblock as field coded in MB-AFF
Use inference flag to remap mvs/references Frame with field co-located
Use inference flag to remap mvs/references
Definition at line 4108 of file mbuffer.c.
References img_par::colour_plane_id, slice::direct_spatial_mv_pred_flag, pic_motion_params::field_frame, storable_picture::JVmotion, storable_picture::motion, pic_motion_params::mv, motion_params::mv, pic_motion_params::ref_id, pic_motion_params::ref_idx, motion_params::ref_idx, and motion_params::ref_pic_id.
Referenced by init_slice().
void copy_storable_param_JV | ( | ImageParameters * | p_Img, | |
int | nplane, | |||
StorablePicture * | d, | |||
StorablePicture * | s | |||
) |
Copy StorablePicture parameters for 4:4:4 Independent mode.
Definition at line 4507 of file mbuffer.c.
References img_par::height, storable_picture::JVmotion, storable_picture::motion, pic_motion_params::mv, pic_motion_params::ref_id, pic_motion_params::ref_idx, pic_motion_params::ref_pic_id, and img_par::width.
Referenced by make_frame_picture_JV().
void dpb_combine_field | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp, | |||
FrameStore * | fs | |||
) |
Generate a frame from top and bottom fields.
Use inference flag to remap mvs/references
Generate Frame parameters from field information.
association with id already known for fields.
need to make association with frames
need to make association with frames
Definition at line 3397 of file mbuffer.c.
References dpb_combine_field_yuv(), pic_motion_params::field_frame, storable_picture::motion, pic_motion_params::mv, pic_motion_params::ref_id, pic_motion_params::ref_idx, UnifiedOneForthPix(), and UnifiedOneForthPix_JV().
Referenced by insert_picture_in_dpb().
void dpb_combine_field_yuv | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp, | |||
FrameStore * | fs | |||
) |
Generate a frame from top and bottom fields, YUV components and display information only.
Definition at line 3333 of file mbuffer.c.
References alloc_storable_picture(), storable_picture::imgUV, and storable_picture::imgY.
Referenced by direct_output(), dpb_combine_field(), and write_unpaired_field().
void dpb_split_field | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp, | |||
FrameStore * | fs | |||
) |
Extract top field from a frame.
association with id already known for fields.
need to make association with frames
Generate field MVs from Frame MVs
Definition at line 3084 of file mbuffer.c.
References alloc_storable_picture(), pic_motion_params::field_frame, storable_picture::imgUV, storable_picture::imgY, pic_motion_params::mb_field, storable_picture::motion, pic_motion_params::mv, pic_motion_params::ref_id, pic_motion_params::ref_idx, UnifiedOneForthPix(), and UnifiedOneForthPix_JV().
Referenced by insert_picture_in_dpb(), and replace_top_pic_with_frame().
void fill_frame_num_gap | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp, | |||
FrameFormat * | output | |||
) |
Tian Dong June 13, 2002, Modifed on July 30, 2003.
If a gap in frame_num is found, try to fill the gap
p_Img | ImageParameters structure | |
p_Inp | InputParameters structure | |
output | FrameFormat for ouput |
Definition at line 3563 of file mbuffer.c.
References alloc_storable_picture(), img_par::frame_num, img_par::height, img_par::height_cr, store_picture_in_dpb(), img_par::width, and img_par::width_cr.
void flush_dpb | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp, | |||
FrameFormat * | output | |||
) |
All stored picture are output. Should be called to empty the buffer.
Definition at line 3034 of file mbuffer.c.
References output_one_frame_from_dpb(), remove_unused_frame_from_dpb(), and unmark_for_reference().
Referenced by adaptive_memory_management(), error(), free_encoder_memory(), and idr_memory_management().
void free_colocated | ( | ColocatedParams * | p | ) |
Free co-located memory.
p | Picture to be freed |
Definition at line 3683 of file mbuffer.c.
References free_motion_params().
Referenced by free_slice().
void free_dpb | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp, | |||
DecodedPictureBuffer * | dpb | |||
) |
Free memory for decoded picture buffer.
Definition at line 259 of file mbuffer.c.
References free_frame_store().
Referenced by free_encoder_memory(), and init_dpb().
void free_frame_store | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp, | |||
FrameStore * | f | |||
) |
Free frame store memory.
p_Img | ImageParameters | |
p_Inp | InputParametes | |
f | FrameStore to be freed |
Definition at line 517 of file mbuffer.c.
References free_storable_picture().
Referenced by free_dpb(), idr_memory_management(), and uninit_out_buffer().
void free_ref_pic_list_reordering_buffer | ( | Slice * | currSlice | ) |
Free memory for buffering of reference picture reordering commands.
Definition at line 3521 of file mbuffer.c.
Referenced by terminate_slice().
void free_storable_picture | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp, | |||
StorablePicture * | p | |||
) |
Free picture memory.
p_Img | ImageParameters | |
p_Inp | InputParametes | |
p | Picture to be freed |
Definition at line 593 of file mbuffer.c.
References storable_picture::dec_imgUV, storable_picture::dec_imgY, free_mem2Dpel(), free_mem3D(), free_mem3Dpel(), free_mem4Dpel(), free_mem5Dpel(), storable_picture::imgUV, storable_picture::imgUV_sub, storable_picture::imgY, storable_picture::imgY_sub, storable_picture::JVmotion, storable_picture::mb_error_map, storable_picture::motion, storable_picture::p_curr_img, storable_picture::p_curr_img_sub, storable_picture::p_dec_img, storable_picture::p_img, storable_picture::p_img_sub, and YUV400.
Referenced by direct_output(), direct_output_paff(), encode_one_frame(), flush_direct_output(), free_frame_store(), free_pictures(), make_frame_picture_JV(), remove_frame_from_dpb(), and replace_top_pic_with_frame().
void init_dpb | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp, | |||
DecodedPictureBuffer * | dpb | |||
) |
Allocate memory for decoded picture buffer and initialize with sane values.
Definition at line 185 of file mbuffer.c.
References alloc_frame_store(), error(), free_dpb(), getDpbSize(), no_mem_exit(), and inp_par_enc::num_ref_frames.
Referenced by init_encoder().
void init_lists | ( | Slice * | currSlice | ) |
Initialize p_Img->listX[0] and list 1 depending on current picture type.
Definition at line 1106 of file mbuffer.c.
References compare_fs_by_frame_num_desc(), compare_fs_by_lt_pic_idx_asc(), compare_fs_by_poc_asc(), compare_fs_by_poc_desc(), compare_pic_by_lt_pic_num_asc(), compare_pic_by_pic_num_desc(), compare_pic_by_poc_asc(), compare_pic_by_poc_desc(), slice::framepoc, gen_pic_list_from_frame_list(), frame_store::is_long_term, frame_store::is_reference, frame_store::is_used, no_mem_exit(), slice::slice_type, and slice::ThisPOC.
Referenced by init_slice().
void init_mbaff_lists | ( | Slice * | currSlice | ) |
Initialize p_Img->listX[2..5] from lists 0 and 1 p_Img->listX[2]: list0 for current_field==top p_Img->listX[3]: list1 for current_field==top p_Img->listX[4]: list0 for current_field==bottom p_Img->listX[5]: list1 for current_field==bottom.
Definition at line 1474 of file mbuffer.c.
Referenced by init_slice().
void reorder_ref_pic_list | ( | Slice * | currSlice, | |
StorablePicture ** | list[6], | |||
char | list_size[6], | |||
int | cur_list | |||
) |
Reordering process for reference picture lists.
Definition at line 1640 of file mbuffer.c.
References error(), reorder_long_term(), and reorder_short_term().
Referenced by init_slice(), reorder_lists(), and wp_mcprec_reorder_lists().
void replace_top_pic_with_frame | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp, | |||
StorablePicture * | p, | |||
FrameFormat * | output | |||
) |
Insert the frame picture into the if the top field has already been stored for the coding decision.
p_Img | ImageParameters | |
p_Inp | InputParameters | |
p | StorablePicture to be inserted | |
output | FrameFormat for output |
Definition at line 2573 of file mbuffer.c.
References direct_output_paff(), dpb_split_field(), img_par::frame_num, free_storable_picture(), frame_store::is_long_term, frame_store::is_reference, frame_store::is_used, img_par::p_dec, UnifiedOneForthPix(), UnifiedOneForthPix_JV(), update_ltref_list(), and update_ref_list().
Referenced by encode_one_frame().
void store_picture_in_dpb | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp, | |||
StorablePicture * | p, | |||
FrameFormat * | output | |||
) |
Store a picture in DPB. This includes cheking for space in DPB and flushing frames. If we received a frame, we need to check for a new store, if we got a field, check if it's the second field of an already allocated store.
p_Img | ImageParameters | |
p_Inp | InputParameters | |
p | Picture to be stored | |
output | FrameFormat for output |
Definition at line 2441 of file mbuffer.c.
References adaptive_memory_management(), check_num_ref(), img_par::currentPicture, direct_output(), dump_dpb(), error(), get_smallest_poc(), idr_memory_management(), insert_picture_in_dpb(), frame_store::is_orig_reference, frame_store::is_used, output_one_frame_from_dpb(), img_par::p_dec, remove_unused_frame_from_dpb(), sliding_window_memory_management(), img_par::structure, update_ltref_list(), and update_ref_list().
Referenced by encode_one_frame(), field_picture(), and fill_frame_num_gap().