#include <limits.h>
#include "global.h"
#include "mbuffer.h"
#include "memalloc.h"
#include "output.h"
#include "image.h"
#include "nalucommon.h"

Go to the source code of this file.
Defines | |
| #define | MAX_LIST_SIZE 33 |
Functions | |
| void | init_stats (StatParameters *stats) |
| static void | insert_picture_in_dpb (FrameStore *fs, StorablePicture *p) |
| static void | output_one_frame_from_dpb (void) |
| static int | is_used_for_reference (FrameStore *fs) |
| static void | get_smallest_poc (int *poc, int *pos) |
| static int | remove_unused_frame_from_dpb (void) |
| static int | is_short_term_reference (FrameStore *fs) |
| static int | is_long_term_reference (FrameStore *fs) |
| void | gen_field_ref_ids (StorablePicture *p) |
| void | dump_dpb (void) |
| int | getDpbSize (void) |
| void | check_num_ref (void) |
| void | init_dpb (void) |
| void | free_dpb (void) |
| FrameStore * | alloc_frame_store (void) |
| void | alloc_pic_motion (PicMotionParams *motion, int size_y, int size_x) |
| StorablePicture * | alloc_storable_picture (PictureStructure structure, int size_x, int size_y, int size_x_cr, int size_y_cr) |
| void | free_frame_store (FrameStore *f) |
| void | free_pic_motion (PicMotionParams *motion) |
| void | free_storable_picture (StorablePicture *p) |
| static void | unmark_for_reference (FrameStore *fs) |
| static void | unmark_for_long_term_reference (FrameStore *fs) |
| static int | compare_pic_by_pic_num_desc (const void *arg1, const void *arg2) |
| static int | compare_pic_by_lt_pic_num_asc (const void *arg1, const void *arg2) |
| static int | compare_fs_by_frame_num_desc (const void *arg1, const void *arg2) |
| static int | compare_fs_by_lt_pic_idx_asc (const void *arg1, const void *arg2) |
| static int | compare_pic_by_poc_asc (const void *arg1, const void *arg2) |
| static int | compare_pic_by_poc_desc (const void *arg1, const void *arg2) |
| static int | compare_fs_by_poc_asc (const void *arg1, const void *arg2) |
| static int | compare_fs_by_poc_desc (const void *arg1, const void *arg2) |
| int | is_short_ref (StorablePicture *s) |
| int | is_long_ref (StorablePicture *s) |
| static void | gen_pic_list_from_frame_list (PictureStructure currStrcture, FrameStore **fs_list, int list_idx, StorablePicture **list, int *list_size, int long_term) |
| void | init_lists (int currSliceType, PictureStructure currPicStructure) |
| void | init_mbaff_lists (void) |
| static StorablePicture * | get_short_term_pic (int picNum) |
| static StorablePicture * | get_long_term_pic (int LongtermPicNum) |
| static void | reorder_short_term (StorablePicture **RefPicListX, int num_ref_idx_lX_active_minus1, int picNumLX, int *refIdxLX) |
| static void | reorder_long_term (StorablePicture **RefPicListX, int num_ref_idx_lX_active_minus1, int LongTermPicNum, int *refIdxLX) |
| void | reorder_ref_pic_list (StorablePicture **list, int *list_size, int num_ref_idx_lX_active_minus1, int *reordering_of_pic_nums_idc, int *abs_diff_pic_num_minus1, int *long_term_pic_idx) |
| void | update_ref_list (void) |
| void | update_ltref_list (void) |
| static void | idr_memory_management (StorablePicture *p) |
| static void | sliding_window_memory_management (StorablePicture *p) |
| static int | get_pic_num_x (StorablePicture *p, int difference_of_pic_nums_minus1) |
| static void | mm_unmark_short_term_for_reference (StorablePicture *p, int difference_of_pic_nums_minus1) |
| static void | mm_unmark_long_term_for_reference (StorablePicture *p, int long_term_pic_num) |
| static void | unmark_long_term_frame_for_reference_by_frame_idx (int long_term_frame_idx) |
| static void | unmark_long_term_field_for_reference_by_frame_idx (PictureStructure structure, int long_term_frame_idx, int mark_current, unsigned curr_frame_num, int curr_pic_num) |
| static void | mark_pic_long_term (StorablePicture *p, int long_term_frame_idx, int picNumX) |
| static void | mm_assign_long_term_frame_idx (StorablePicture *p, int difference_of_pic_nums_minus1, int long_term_frame_idx) |
| void | mm_update_max_long_term_frame_idx (int max_long_term_frame_idx_plus1) |
| static void | mm_unmark_all_long_term_for_reference (void) |
| static void | mm_unmark_all_short_term_for_reference (void) |
| static void | mm_mark_current_picture_long_term (StorablePicture *p, int long_term_frame_idx) |
| static void | adaptive_memory_management (StorablePicture *p) |
| void | store_picture_in_dpb (StorablePicture *p) |
| void | replace_top_pic_with_frame (StorablePicture *p) |
| static void | remove_frame_from_dpb (int pos) |
| void | flush_dpb (void) |
| void | dpb_split_field (FrameStore *fs) |
| void | dpb_combine_field_yuv (FrameStore *fs) |
| void | dpb_combine_field (FrameStore *fs) |
| void | alloc_ref_pic_list_reordering_buffer (Slice *currSlice) |
| void | free_ref_pic_list_reordering_buffer (Slice *currSlice) |
| void | fill_frame_num_gap (ImageParameters *img) |
| void | alloc_motion_params (MotionParams *ftype, int size_y, int size_x) |
| ColocatedParams * | alloc_colocated (int size_x, int size_y, int mb_adaptive_frame_field_flag) |
| void | free_motion_params (MotionParams *ftype) |
| void | free_colocated (ColocatedParams *p) |
| void | compute_colocated (ColocatedParams *p, StorablePicture **listX[6]) |
| void | compute_colocated_JV (ColocatedParams *p, StorablePicture **listX[6]) |
| void | copy_storable_param_JV (int nplane, StorablePicture *d, StorablePicture *s) |
Variables | |
| DecodedPictureBuffer | dpb |
| StorablePicture ** | listX [6] |
| ColocatedParams * | Co_located = NULL |
| ColocatedParams * | Co_located_JV [MAX_PLANE] = { NULL, NULL, NULL } |
| int | listXsize [6] |
Definition in file mbuffer.c.
| static void adaptive_memory_management | ( | StorablePicture * | p | ) | [static] |
Perform Adaptive memory control decoded reference picture marking process.
Definition at line 2291 of file mbuffer.c.
References ImageParameters::adaptive_ref_pic_buffering_flag, storable_picture::bottom_poc, ImageParameters::bottompoc, check_num_ref(), ImageParameters::currentPicture, ImageParameters::dec_ref_pic_marking_buffer, DecRefPicMarking_s::difference_of_pic_nums_minus1, error(), flush_dpb(), storable_picture::frame_num, ImageParameters::framepoc, ImageParameters::last_has_mmco_5, DecRefPicMarking_s::long_term_frame_idx, DecRefPicMarking_s::long_term_pic_num, DecRefPicMarking_s::max_long_term_frame_idx_plus1, DecRefPicMarking_s::memory_management_control_operation, mm_assign_long_term_frame_idx(), mm_mark_current_picture_long_term(), mm_unmark_all_long_term_for_reference(), mm_unmark_all_short_term_for_reference(), mm_unmark_long_term_for_reference(), mm_unmark_short_term_for_reference(), mm_update_max_long_term_frame_idx(), DecRefPicMarking_s::Next, storable_picture::pic_num, storable_picture::poc, storable_picture::structure, ImageParameters::ThisPOC, storable_picture::top_poc, ImageParameters::toppoc, update_ltref_list(), and update_ref_list().
Referenced by store_picture_in_dpb().

| 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 3548 of file mbuffer.c.
References alloc_motion_params(), colocated_params::bottom, colocated_params::frame, colocated_params::mb_adaptive_frame_field_flag, no_mem_exit(), colocated_params::size_x, colocated_params::size_y, and colocated_params::top.
Referenced by GenerateSequenceParameterSet().

| FrameStore* alloc_frame_store | ( | void | ) |
Allocate memory for decoded picture buffer frame stores an initialize with sane values.
Definition at line 305 of file mbuffer.c.
References frame_store::bottom_field, f, frame_store::frame, frame_store::is_long_term, frame_store::is_orig_reference, frame_store::is_output, frame_store::is_reference, frame_store::is_used, no_mem_exit(), and frame_store::top_field.
Referenced by idr_memory_management(), init_dpb(), and init_out_buffer().

| void alloc_motion_params | ( | MotionParams * | ftype, | |
| int | size_y, | |||
| int | size_x | |||
| ) |
Allocate motion parameter memory for colocated structure.
Definition at line 3524 of file mbuffer.c.
References get_mem2D(), get_mem3D(), get_mem3Dint64(), get_mem4Dshort(), motion_params::moving_block, motion_params::mv, motion_params::ref_idx, and motion_params::ref_pic_id.
Referenced by alloc_colocated().

| void alloc_ref_pic_list_reordering_buffer | ( | Slice * | currSlice | ) |
Allocate memory for buffering of reference picture reordering commands.
Definition at line 3406 of file mbuffer.c.
References Slice::abs_diff_pic_num_minus1_l0, Slice::abs_diff_pic_num_minus1_l1, Slice::long_term_pic_idx_l0, Slice::long_term_pic_idx_l1, no_mem_exit(), ImageParameters::num_ref_idx_l0_active, ImageParameters::num_ref_idx_l1_active, Slice::reordering_of_pic_nums_idc_l0, Slice::reordering_of_pic_nums_idc_l1, and ImageParameters::type.
Referenced by init_slice(), and wpxReorderLists().

| StorablePicture* alloc_storable_picture | ( | PictureStructure | structure, | |
| int | size_x, | |||
| int | size_y, | |||
| int | size_x_cr, | |||
| int | size_y_cr | |||
| ) |
Allocate memory for a stored picture.
| 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 370 of file mbuffer.c.
References storable_picture::bottom_field, storable_picture::coded_frame, storable_picture::dec_imgUV, storable_picture::dec_imgY, storable_picture::frame, storable_picture::frame_num, 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::is_long_term, storable_picture::is_output, storable_picture::JVmotion, storable_picture::long_term_frame_idx, storable_picture::long_term_pic_num, ImageParameters::mb_cr_size_x, ImageParameters::mb_cr_size_y, storable_picture::mb_error_map, storable_picture::MbaffFrameFlag, storable_picture::motion, no_mem_exit(), storable_picture::non_existing, InputParameters::NoOfDecoders, 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, storable_picture::pic_num, InputParameters::rdopt, storable_picture::size_x, storable_picture::size_x_cr, storable_picture::size_x_cr_pad, storable_picture::size_x_pad, storable_picture::size_x_padded, storable_picture::size_y, storable_picture::size_y_cr, storable_picture::size_y_cr_pad, storable_picture::size_y_pad, storable_picture::size_y_padded, storable_picture::stats, storable_picture::structure, storable_picture::top_field, storable_picture::used_for_reference, YUV400, and ImageParameters::yuv_format.
Referenced by dpb_combine_field_yuv(), dpb_split_field(), field_picture(), fill_frame_num_gap(), prepare_enc_frame_picture(), and write_unpaired_field().

| void check_num_ref | ( | void | ) |
Check then number of frames marked "used for reference" and break if maximum is exceeded.
Definition at line 176 of file mbuffer.c.
References error(), decoded_picture_buffer::ltref_frames_in_buffer, ImageParameters::num_ref_frames, and decoded_picture_buffer::ref_frames_in_buffer.
Referenced by adaptive_memory_management(), and store_picture_in_dpb().

| static int compare_fs_by_frame_num_desc | ( | const void * | arg1, | |
| const void * | arg2 | |||
| ) | [static] |
compares two frame stores by pic_num for qsort in descending order
Definition at line 849 of file mbuffer.c.
Referenced by init_lists().
| static int compare_fs_by_lt_pic_idx_asc | ( | const void * | arg1, | |
| const void * | arg2 | |||
| ) | [static] |
compares two frame stores by lt_pic_num for qsort in descending order
Definition at line 867 of file mbuffer.c.
Referenced by init_lists().
| static int compare_fs_by_poc_asc | ( | const void * | arg1, | |
| const void * | arg2 | |||
| ) | [static] |
compares two frame stores by poc for qsort in ascending order
Definition at line 921 of file mbuffer.c.
Referenced by init_lists().
| static int compare_fs_by_poc_desc | ( | const void * | arg1, | |
| const void * | arg2 | |||
| ) | [static] |
compares two frame stores by poc for qsort in descending order
Definition at line 939 of file mbuffer.c.
Referenced by init_lists().
| static int compare_pic_by_lt_pic_num_asc | ( | const void * | arg1, | |
| const void * | arg2 | |||
| ) | [static] |
compares two stored pictures by picture number for qsort in descending order
Definition at line 832 of file mbuffer.c.
Referenced by init_lists().
| static int compare_pic_by_pic_num_desc | ( | const void * | arg1, | |
| const void * | arg2 | |||
| ) | [static] |
compares two stored pictures by picture number for qsort in descending order
Definition at line 815 of file mbuffer.c.
Referenced by init_lists().
| static int compare_pic_by_poc_asc | ( | const void * | arg1, | |
| const void * | arg2 | |||
| ) | [static] |
compares two stored pictures by poc for qsort in ascending order
Definition at line 885 of file mbuffer.c.
Referenced by init_lists().
| static int compare_pic_by_poc_desc | ( | const void * | arg1, | |
| const void * | arg2 | |||
| ) | [static] |
compares two stored pictures by poc for qsort in descending order
Definition at line 903 of file mbuffer.c.
Referenced by init_lists().
| void compute_colocated | ( | 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 3629 of file mbuffer.c.
References colocated_params::bottom, storable_picture::bottom_field, storable_picture::bottom_poc, storable_picture::coded_frame, ImageParameters::direct_spatial_mv_pred_flag, pic_motion_params::field_frame, colocated_params::frame, storable_picture::is_long_term, colocated_params::is_long_term, ImageParameters::MbaffFrameFlag, storable_picture::motion, motion_params::moving_block, pic_motion_params::mv, motion_params::mv, ImageParameters::mvscale, storable_picture::poc, pic_motion_params::ref_id, pic_motion_params::ref_idx, motion_params::ref_idx, motion_params::ref_pic_id, storable_picture::size_x, storable_picture::size_y, storable_picture::structure, ImageParameters::structure, colocated_params::top, storable_picture::top_field, and storable_picture::top_poc.
Referenced by init_slice().
| void compute_colocated_JV | ( | 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 4027 of file mbuffer.c.
References colocated_params::bottom, storable_picture::bottom_field, storable_picture::bottom_poc, storable_picture::coded_frame, ImageParameters::colour_plane_id, ImageParameters::direct_spatial_mv_pred_flag, pic_motion_params::field_frame, colocated_params::frame, storable_picture::is_long_term, colocated_params::is_long_term, storable_picture::JVmotion, ImageParameters::MbaffFrameFlag, storable_picture::motion, motion_params::moving_block, pic_motion_params::mv, motion_params::mv, ImageParameters::mvscale, storable_picture::poc, pic_motion_params::ref_id, pic_motion_params::ref_idx, motion_params::ref_idx, motion_params::ref_pic_id, storable_picture::size_x, storable_picture::size_y, storable_picture::structure, ImageParameters::structure, colocated_params::top, storable_picture::top_field, and storable_picture::top_poc.
Referenced by init_slice().
| void copy_storable_param_JV | ( | int | nplane, | |
| StorablePicture * | d, | |||
| StorablePicture * | s | |||
| ) |
Copy StorablePicture parameters for 4:4:4 Independent mode.
Definition at line 4425 of file mbuffer.c.
References ImageParameters::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 ImageParameters::width.
Referenced by make_frame_picture_JV().
| void dpb_combine_field | ( | 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 3322 of file mbuffer.c.
References frame_store::bottom_field, dpb_combine_field_yuv(), pic_motion_params::field_frame, frame_store::frame, storable_picture::frm_ref_pic_num, storable_picture::motion, pic_motion_params::mv, pic_motion_params::ref_id, pic_motion_params::ref_idx, storable_picture::ref_pic_num, storable_picture::size_x, storable_picture::size_y, frame_store::top_field, UnifiedOneForthPix(), and UnifiedOneForthPix_JV().
Referenced by insert_picture_in_dpb().

| void dpb_combine_field_yuv | ( | FrameStore * | fs | ) |
Generate a frame from top and bottom fields, YUV components and display information only.
Definition at line 3263 of file mbuffer.c.
References alloc_storable_picture(), storable_picture::bottom_field, frame_store::bottom_field, storable_picture::bottom_poc, storable_picture::chroma_format_idc, storable_picture::coded_frame, storable_picture::frame, frame_store::frame, storable_picture::frame_cropping_flag, storable_picture::frame_cropping_rect_bottom_offset, storable_picture::frame_cropping_rect_left_offset, storable_picture::frame_cropping_rect_right_offset, storable_picture::frame_cropping_rect_top_offset, storable_picture::frame_poc, storable_picture::imgUV, storable_picture::imgY, storable_picture::is_long_term, frame_store::long_term_frame_idx, storable_picture::long_term_frame_idx, storable_picture::poc, frame_store::poc, storable_picture::size_x, storable_picture::size_x_cr, storable_picture::size_y, storable_picture::size_y_cr, storable_picture::top_field, frame_store::top_field, storable_picture::top_poc, and storable_picture::used_for_reference.
Referenced by direct_output(), dpb_combine_field(), and write_unpaired_field().

| void dpb_split_field | ( | 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 3018 of file mbuffer.c.
References alloc_storable_picture(), storable_picture::bottom_field, frame_store::bottom_field, storable_picture::bottom_poc, storable_picture::bottom_ref_pic_num, storable_picture::chroma_format_idc, storable_picture::coded_frame, pic_motion_params::field_frame, storable_picture::frame, frame_store::frame, storable_picture::frame_poc, storable_picture::frm_ref_pic_num, storable_picture::imgUV, storable_picture::imgY, storable_picture::is_long_term, storable_picture::long_term_frame_idx, frame_store::long_term_frame_idx, pic_motion_params::mb_field, storable_picture::MbaffFrameFlag, storable_picture::motion, pic_motion_params::mv, storable_picture::poc, frame_store::poc, pic_motion_params::ref_id, pic_motion_params::ref_idx, storable_picture::ref_pic_num, storable_picture::size_x, storable_picture::size_x_cr, storable_picture::size_y, storable_picture::size_y_cr, storable_picture::top_field, frame_store::top_field, storable_picture::top_poc, storable_picture::top_ref_pic_num, UnifiedOneForthPix(), UnifiedOneForthPix_JV(), and storable_picture::used_for_reference.
Referenced by insert_picture_in_dpb(), and replace_top_pic_with_frame().

| void dump_dpb | ( | void | ) |
Print out list of pictures in DPB. Used for debug purposes.
Definition at line 54 of file mbuffer.c.
References frame_store::bottom_field, storable_picture::bottom_poc, frame_store::frame, frame_store::frame_num, decoded_picture_buffer::fs, frame_store::is_long_term, frame_store::is_output, frame_store::is_reference, frame_store::is_used, storable_picture::non_existing, frame_store::poc, storable_picture::poc, frame_store::top_field, storable_picture::top_poc, and decoded_picture_buffer::used_size.
Referenced by store_picture_in_dpb().
| void fill_frame_num_gap | ( | ImageParameters * | img | ) |
Tian Dong June 13, 2002, Modifed on July 30, 2003.
If a gap in frame_num is found, try to fill the gap
| img |
Definition at line 3483 of file mbuffer.c.
References ImageParameters::adaptive_ref_pic_buffering_flag, alloc_storable_picture(), storable_picture::coded_frame, ImageParameters::frame_num, ImageParameters::height, ImageParameters::height_cr, storable_picture::is_output, ImageParameters::nal_reference_idc, storable_picture::non_existing, storable_picture::pic_num, ImageParameters::pre_frame_num, store_picture_in_dpb(), ImageParameters::width, and ImageParameters::width_cr.

| void flush_dpb | ( | void | ) |
All stored picture are output. Should be called to empty the buffer.
Definition at line 2969 of file mbuffer.c.
References decoded_picture_buffer::fs, decoded_picture_buffer::last_output_poc, output_one_frame_from_dpb(), remove_unused_frame_from_dpb(), unmark_for_reference(), and decoded_picture_buffer::used_size.
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 3603 of file mbuffer.c.
References colocated_params::bottom, colocated_params::frame, free_motion_params(), colocated_params::mb_adaptive_frame_field_flag, and colocated_params::top.
Referenced by free_encoder_memory().

| void free_dpb | ( | void | ) |
Free memory for decoded picture buffer.
Definition at line 263 of file mbuffer.c.
References free_frame_store(), decoded_picture_buffer::fs, decoded_picture_buffer::fs_ltref, decoded_picture_buffer::fs_ref, decoded_picture_buffer::init_done, decoded_picture_buffer::last_output_poc, and decoded_picture_buffer::size.
Referenced by free_encoder_memory(), and init_dpb().

| void free_frame_store | ( | FrameStore * | f | ) |
Free frame store memory.
| f | FrameStore to be freed |
Definition at line 510 of file mbuffer.c.
References frame_store::bottom_field, frame_store::frame, free_storable_picture(), and frame_store::top_field.
Referenced by free_dpb(), idr_memory_management(), and uninit_out_buffer().

| void free_motion_params | ( | MotionParams * | ftype | ) |
Free motion parameter memory for colocated structure.
Definition at line 3580 of file mbuffer.c.
References free_mem2D(), free_mem3D(), free_mem3Dint64(), free_mem4Dshort(), motion_params::moving_block, motion_params::mv, motion_params::ref_idx, and motion_params::ref_pic_id.
Referenced by free_colocated().

| void free_ref_pic_list_reordering_buffer | ( | Slice * | currSlice | ) |
Free memory for buffering of reference picture reordering commands.
Definition at line 3446 of file mbuffer.c.
References Slice::abs_diff_pic_num_minus1_l0, Slice::abs_diff_pic_num_minus1_l1, Slice::long_term_pic_idx_l0, Slice::long_term_pic_idx_l1, Slice::reordering_of_pic_nums_idc_l0, and Slice::reordering_of_pic_nums_idc_l1.
Referenced by terminate_slice().
| void free_storable_picture | ( | StorablePicture * | p | ) |
Free picture memory.
| p | Picture to be freed |
Definition at line 582 of file mbuffer.c.
References InputParameters::ChromaMCBuffer, 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, YUV400, and ImageParameters::yuv_format.
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 gen_field_ref_ids | ( | StorablePicture * | p | ) |
Generate Frame parameters from field information.
association with id already known for fields.
Definition at line 2994 of file mbuffer.c.
References pic_motion_params::field_frame, storable_picture::motion, pic_motion_params::ref_id, pic_motion_params::ref_idx, storable_picture::ref_pic_num, storable_picture::size_x, and storable_picture::size_y.
Referenced by insert_picture_in_dpb().
| static void gen_pic_list_from_frame_list | ( | PictureStructure | currStrcture, | |
| FrameStore ** | fs_list, | |||
| int | list_idx, | |||
| StorablePicture ** | list, | |||
| int * | list_size, | |||
| int | long_term | |||
| ) | [static] |
Generates a alternating field list from a given FrameStore list.
Definition at line 983 of file mbuffer.c.
References frame_store::bottom_field, is_long_ref(), is_short_ref(), and frame_store::top_field.
Referenced by init_lists().

| static StorablePicture* get_long_term_pic | ( | int | LongtermPicNum | ) | [static] |
Returns short term pic with given LongtermPicNum.
Definition at line 1512 of file mbuffer.c.
References frame_store::bottom_field, frame_store::frame, decoded_picture_buffer::fs_ltref, storable_picture::is_long_term, frame_store::is_reference, storable_picture::long_term_pic_num, decoded_picture_buffer::ltref_frames_in_buffer, ImageParameters::structure, and frame_store::top_field.
Referenced by reorder_long_term().
| static int get_pic_num_x | ( | StorablePicture * | p, | |
| int | difference_of_pic_nums_minus1 | |||
| ) | [static] |
Calculate picNumX.
Definition at line 1808 of file mbuffer.c.
References storable_picture::frame_num, and storable_picture::structure.
Referenced by mm_assign_long_term_frame_idx(), and mm_unmark_short_term_for_reference().
| static StorablePicture* get_short_term_pic | ( | int | picNum | ) | [static] |
Returns short term pic with given picNum.
Definition at line 1480 of file mbuffer.c.
References frame_store::bottom_field, frame_store::frame, decoded_picture_buffer::fs_ref, storable_picture::is_long_term, frame_store::is_reference, storable_picture::pic_num, decoded_picture_buffer::ref_frames_in_buffer, ImageParameters::structure, and frame_store::top_field.
Referenced by reorder_short_term().
| static void get_smallest_poc | ( | int * | poc, | |
| int * | pos | |||
| ) | [static] |
find smallest POC in the DPB.
Definition at line 2874 of file mbuffer.c.
References error(), decoded_picture_buffer::fs, frame_store::is_output, frame_store::poc, and decoded_picture_buffer::used_size.
Referenced by output_one_frame_from_dpb(), and store_picture_in_dpb().

| int getDpbSize | ( | void | ) |
Returns the size of the dpb depending on level and picture size.
Definition at line 100 of file mbuffer.c.
References error().
Referenced by init_dpb().

| static void idr_memory_management | ( | StorablePicture * | p | ) | [static] |
Perform Memory management for idr pictures.
Definition at line 1725 of file mbuffer.c.
References alloc_frame_store(), ImageParameters::currentPicture, flush_dpb(), free_frame_store(), decoded_picture_buffer::fs, decoded_picture_buffer::fs_ltref, decoded_picture_buffer::fs_ref, storable_picture::is_long_term, decoded_picture_buffer::last_output_poc, decoded_picture_buffer::last_picture, storable_picture::long_term_frame_idx, ImageParameters::long_term_reference_flag, decoded_picture_buffer::ltref_frames_in_buffer, decoded_picture_buffer::max_long_term_pic_idx, ImageParameters::no_output_of_prior_pics_flag, decoded_picture_buffer::ref_frames_in_buffer, update_ltref_list(), update_ref_list(), and decoded_picture_buffer::used_size.
Referenced by store_picture_in_dpb().

| void init_dpb | ( | void | ) |
Allocate memory for decoded picture buffer and initialize with sane values.
Definition at line 192 of file mbuffer.c.
References alloc_frame_store(), error(), free_dpb(), decoded_picture_buffer::fs, decoded_picture_buffer::fs_ltref, decoded_picture_buffer::fs_ref, getDpbSize(), decoded_picture_buffer::init_done, ImageParameters::last_has_mmco_5, decoded_picture_buffer::last_output_poc, decoded_picture_buffer::last_picture, decoded_picture_buffer::ltref_frames_in_buffer, no_mem_exit(), InputParameters::num_ref_frames, decoded_picture_buffer::ref_frames_in_buffer, decoded_picture_buffer::size, and decoded_picture_buffer::used_size.
Referenced by init_encoder().

| void init_lists | ( | int | currSliceType, | |
| PictureStructure | currPicStructure | |||
| ) |
Initialize listX[0] and list 1 depending on current picture type.
Definition at line 1073 of file mbuffer.c.
References frame_store::bottom_field, 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(), frame_store::frame, ImageParameters::frame_num, frame_store::frame_num, frame_store::frame_num_wrap, ImageParameters::framepoc, decoded_picture_buffer::fs_ltref, decoded_picture_buffer::fs_ref, gen_pic_list_from_frame_list(), frame_store::is_long_term, storable_picture::is_long_term, frame_store::is_reference, frame_store::is_used, storable_picture::long_term_frame_idx, storable_picture::long_term_pic_num, decoded_picture_buffer::ltref_frames_in_buffer, no_mem_exit(), ImageParameters::num_ref_idx_l0_active, ImageParameters::num_ref_idx_l1_active, storable_picture::pic_num, frame_store::poc, storable_picture::poc, decoded_picture_buffer::ref_frames_in_buffer, decoded_picture_buffer::size, ImageParameters::ThisPOC, frame_store::top_field, and storable_picture::used_for_reference.
Referenced by init_slice().

| void init_mbaff_lists | ( | void | ) |
Initialize listX[2..5] from lists 0 and 1 listX[2]: list0 for current_field==top listX[3]: list1 for current_field==top listX[4]: list0 for current_field==bottom listX[5]: list1 for current_field==bottom.
Definition at line 1440 of file mbuffer.c.
References storable_picture::bottom_field, and storable_picture::top_field.
Referenced by init_slice().
| static void insert_picture_in_dpb | ( | FrameStore * | fs, | |
| StorablePicture * | p | |||
| ) | [static] |
Insert the picture into the DPB. A free DPB position is necessary for frames, .
| fs | FrameStore into which the picture will be inserted | |
| p | StorablePicture to be inserted |
Definition at line 2594 of file mbuffer.c.
References frame_store::bottom_field, dpb_combine_field(), dpb_split_field(), frame_store::frame, frame_store::frame_num, gen_field_ref_ids(), frame_store::is_long_term, storable_picture::is_long_term, frame_store::is_orig_reference, storable_picture::is_output, frame_store::is_output, frame_store::is_reference, frame_store::is_used, storable_picture::long_term_frame_idx, frame_store::long_term_frame_idx, storable_picture::pic_num, storable_picture::poc, frame_store::poc, storable_picture::structure, frame_store::top_field, UnifiedOneForthPix(), UnifiedOneForthPix_JV(), and storable_picture::used_for_reference.
Referenced by store_picture_in_dpb().

| int is_long_ref | ( | StorablePicture * | s | ) |
returns true, if picture is long term reference picture
Definition at line 970 of file mbuffer.c.
References storable_picture::is_long_term, and storable_picture::used_for_reference.
Referenced by gen_pic_list_from_frame_list().
| static int is_long_term_reference | ( | FrameStore * | fs | ) | [static] |
Check if one of the frames/fields in frame store is used for short-term reference.
Definition at line 2780 of file mbuffer.c.
References frame_store::bottom_field, frame_store::frame, storable_picture::is_long_term, frame_store::is_used, frame_store::top_field, and storable_picture::used_for_reference.
Referenced by update_ltref_list().
| int is_short_ref | ( | StorablePicture * | s | ) |
returns true, if picture is short term reference picture
Definition at line 957 of file mbuffer.c.
References storable_picture::is_long_term, and storable_picture::used_for_reference.
Referenced by gen_pic_list_from_frame_list().
| static int is_short_term_reference | ( | FrameStore * | fs | ) | [static] |
Check if one of the frames/fields in frame store is used for short-term reference.
Definition at line 2738 of file mbuffer.c.
References frame_store::bottom_field, frame_store::frame, storable_picture::is_long_term, frame_store::is_used, frame_store::top_field, and storable_picture::used_for_reference.
Referenced by update_ref_list().
| static int is_used_for_reference | ( | FrameStore * | fs | ) | [static] |
Check if one of the frames/fields in frame store is used for reference.
Definition at line 2692 of file mbuffer.c.
References frame_store::bottom_field, frame_store::frame, frame_store::is_reference, frame_store::is_used, frame_store::top_field, and storable_picture::used_for_reference.
Referenced by output_one_frame_from_dpb(), and remove_unused_frame_from_dpb().
| static void mark_pic_long_term | ( | StorablePicture * | p, | |
| int | long_term_frame_idx, | |||
| int | picNumX | |||
| ) | [static] |
mark a picture as long-term reference
Definition at line 2059 of file mbuffer.c.
References frame_store::bottom_field, frame_store::frame, decoded_picture_buffer::fs_ref, frame_store::is_long_term, storable_picture::is_long_term, frame_store::is_reference, storable_picture::long_term_frame_idx, frame_store::long_term_frame_idx, storable_picture::long_term_pic_num, storable_picture::pic_num, decoded_picture_buffer::ref_frames_in_buffer, storable_picture::structure, and frame_store::top_field.
Referenced by mm_assign_long_term_frame_idx().
| static void mm_assign_long_term_frame_idx | ( | StorablePicture * | p, | |
| int | difference_of_pic_nums_minus1, | |||
| int | long_term_frame_idx | |||
| ) | [static] |
Assign a long term frame index to a short term picture.
Definition at line 2165 of file mbuffer.c.
References frame_store::bottom_field, error(), decoded_picture_buffer::fs_ref, get_pic_num_x(), frame_store::is_reference, mark_pic_long_term(), storable_picture::pic_num, decoded_picture_buffer::ref_frames_in_buffer, storable_picture::structure, frame_store::top_field, unmark_long_term_field_for_reference_by_frame_idx(), and unmark_long_term_frame_for_reference_by_frame_idx().
Referenced by adaptive_memory_management().

| static void mm_mark_current_picture_long_term | ( | StorablePicture * | p, | |
| int | long_term_frame_idx | |||
| ) | [static] |
Mark the current picture used for long term reference.
Definition at line 2268 of file mbuffer.c.
References storable_picture::is_long_term, storable_picture::long_term_frame_idx, storable_picture::pic_num, storable_picture::structure, unmark_long_term_field_for_reference_by_frame_idx(), and unmark_long_term_frame_for_reference_by_frame_idx().
Referenced by adaptive_memory_management().

| static void mm_unmark_all_long_term_for_reference | ( | void | ) | [static] |
Mark all long term reference pictures unused for reference.
Definition at line 2240 of file mbuffer.c.
References mm_update_max_long_term_frame_idx().
Referenced by adaptive_memory_management().

| static void mm_unmark_all_short_term_for_reference | ( | void | ) | [static] |
Mark all short term reference pictures unused for reference.
Definition at line 2251 of file mbuffer.c.
References decoded_picture_buffer::fs_ref, decoded_picture_buffer::ref_frames_in_buffer, unmark_for_reference(), and update_ref_list().
Referenced by adaptive_memory_management().

| static void mm_unmark_long_term_for_reference | ( | StorablePicture * | p, | |
| int | long_term_pic_num | |||
| ) | [static] |
Adaptive Memory Management: Mark long term picture unused.
Definition at line 1887 of file mbuffer.c.
References frame_store::bottom_field, frame_store::frame, decoded_picture_buffer::fs_ltref, storable_picture::is_long_term, frame_store::is_long_term, frame_store::is_reference, frame_store::is_used, storable_picture::long_term_pic_num, decoded_picture_buffer::ltref_frames_in_buffer, storable_picture::structure, frame_store::top_field, unmark_for_long_term_reference(), and storable_picture::used_for_reference.
Referenced by adaptive_memory_management().

| static void mm_unmark_short_term_for_reference | ( | StorablePicture * | p, | |
| int | difference_of_pic_nums_minus1 | |||
| ) | [static] |
Adaptive Memory Management: Mark short term picture unused.
Definition at line 1827 of file mbuffer.c.
References frame_store::bottom_field, frame_store::frame, decoded_picture_buffer::fs_ref, get_pic_num_x(), frame_store::is_long_term, frame_store::is_reference, frame_store::is_used, storable_picture::pic_num, decoded_picture_buffer::ref_frames_in_buffer, storable_picture::structure, frame_store::top_field, unmark_for_reference(), and storable_picture::used_for_reference.
Referenced by adaptive_memory_management().

| void mm_update_max_long_term_frame_idx | ( | int | max_long_term_frame_idx_plus1 | ) |
Set new max long_term_frame_idx.
Definition at line 2217 of file mbuffer.c.
References decoded_picture_buffer::fs_ltref, frame_store::long_term_frame_idx, decoded_picture_buffer::ltref_frames_in_buffer, decoded_picture_buffer::max_long_term_pic_idx, and unmark_for_long_term_reference().
Referenced by adaptive_memory_management(), and mm_unmark_all_long_term_for_reference().

| static void output_one_frame_from_dpb | ( | void | ) | [static] |
Output one picture stored in the DPB.
Definition at line 2923 of file mbuffer.c.
References error(), decoded_picture_buffer::fs, get_smallest_poc(), is_used_for_reference(), decoded_picture_buffer::last_output_poc, p_dec, InputParameters::redundant_pic_flag, remove_frame_from_dpb(), decoded_picture_buffer::used_size, and write_stored_frame().
Referenced by flush_dpb(), and store_picture_in_dpb().

| static void remove_frame_from_dpb | ( | int | pos | ) | [static] |
remove one frame from DPB
Definition at line 2822 of file mbuffer.c.
References frame_store::bottom_field, error(), frame_store::frame, free_storable_picture(), decoded_picture_buffer::fs, frame_store::is_long_term, frame_store::is_orig_reference, frame_store::is_reference, frame_store::is_used, frame_store::top_field, and decoded_picture_buffer::used_size.
Referenced by output_one_frame_from_dpb(), and remove_unused_frame_from_dpb().

| static int remove_unused_frame_from_dpb | ( | void | ) | [static] |
Remove a picture from DPB which is no longer needed.
Definition at line 2901 of file mbuffer.c.
References decoded_picture_buffer::fs, frame_store::is_output, is_used_for_reference(), remove_frame_from_dpb(), and decoded_picture_buffer::used_size.
Referenced by flush_dpb(), and store_picture_in_dpb().

| static void reorder_long_term | ( | StorablePicture ** | RefPicListX, | |
| int | num_ref_idx_lX_active_minus1, | |||
| int | LongTermPicNum, | |||
| int * | refIdxLX | |||
| ) | [static] |
Reordering process for short-term reference pictures.
Definition at line 1574 of file mbuffer.c.
References get_long_term_pic().
Referenced by reorder_ref_pic_list().

| void reorder_ref_pic_list | ( | StorablePicture ** | list, | |
| int * | list_size, | |||
| int | num_ref_idx_lX_active_minus1, | |||
| int * | reordering_of_pic_nums_idc, | |||
| int * | abs_diff_pic_num_minus1, | |||
| int * | long_term_pic_idx | |||
| ) |
Reordering process for reference picture lists.
Definition at line 1602 of file mbuffer.c.
References error(), ImageParameters::frame_num, reorder_long_term(), reorder_short_term(), and ImageParameters::structure.
Referenced by init_slice(), ref_pic_list_reordering(), and wpxReorderLists().

| static void reorder_short_term | ( | StorablePicture ** | RefPicListX, | |
| int | num_ref_idx_lX_active_minus1, | |||
| int | picNumLX, | |||
| int * | refIdxLX | |||
| ) | [static] |
Reordering process for short-term reference pictures.
Definition at line 1544 of file mbuffer.c.
References get_short_term_pic().
Referenced by reorder_ref_pic_list().

| void replace_top_pic_with_frame | ( | StorablePicture * | p | ) |
Insert the frame picture into the if the top field has already been stored for the coding decision.
| p | StorablePicture to be inserted |
Definition at line 2517 of file mbuffer.c.
References direct_output_paff(), dpb_split_field(), frame_store::frame, ImageParameters::frame_num, frame_store::frame_num, free_storable_picture(), decoded_picture_buffer::fs, frame_store::is_long_term, storable_picture::is_long_term, frame_store::is_reference, frame_store::is_used, ImageParameters::nal_reference_idc, p_dec, storable_picture::structure, frame_store::top_field, ImageParameters::type, storable_picture::type, UnifiedOneForthPix(), UnifiedOneForthPix_JV(), update_ltref_list(), update_ref_list(), storable_picture::used_for_reference, and decoded_picture_buffer::used_size.
Referenced by encode_one_frame().

| static void sliding_window_memory_management | ( | StorablePicture * | p | ) | [static] |
Perform Sliding window decoded reference picture marking process.
Definition at line 1780 of file mbuffer.c.
References ImageParameters::currentPicture, decoded_picture_buffer::fs, storable_picture::is_long_term, frame_store::is_long_term, frame_store::is_reference, decoded_picture_buffer::ltref_frames_in_buffer, decoded_picture_buffer::ref_frames_in_buffer, unmark_for_reference(), update_ref_list(), and decoded_picture_buffer::used_size.
Referenced by store_picture_in_dpb().

| void store_picture_in_dpb | ( | StorablePicture * | p | ) |
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 | Picture to be stored |
Definition at line 2392 of file mbuffer.c.
References adaptive_memory_management(), ImageParameters::adaptive_ref_pic_buffering_flag, check_num_ref(), ImageParameters::currentPicture, direct_output(), dump_dpb(), error(), storable_picture::frame_num, frame_store::frame_num, decoded_picture_buffer::fs, decoded_picture_buffer::fs_ref, get_smallest_poc(), idr_memory_management(), insert_picture_in_dpb(), storable_picture::is_long_term, frame_store::is_orig_reference, frame_store::is_used, ImageParameters::last_has_mmco_5, ImageParameters::last_pic_bottom_field, decoded_picture_buffer::last_picture, ImageParameters::nal_reference_idc, output_one_frame_from_dpb(), p_dec, storable_picture::pic_num, storable_picture::poc, decoded_picture_buffer::ref_frames_in_buffer, remove_unused_frame_from_dpb(), decoded_picture_buffer::size, sliding_window_memory_management(), storable_picture::structure, ImageParameters::structure, ImageParameters::type, storable_picture::type, update_ltref_list(), update_ref_list(), storable_picture::used_for_reference, and decoded_picture_buffer::used_size.
Referenced by encode_one_frame(), field_picture(), and fill_frame_num_gap().

| static void unmark_for_long_term_reference | ( | FrameStore * | fs | ) | [static] |
mark FrameStore unused for reference and reset long term flags
Definition at line 771 of file mbuffer.c.
References frame_store::bottom_field, frame_store::frame, frame_store::is_long_term, storable_picture::is_long_term, frame_store::is_reference, frame_store::is_used, frame_store::top_field, and storable_picture::used_for_reference.
Referenced by mm_unmark_long_term_for_reference(), mm_update_max_long_term_frame_idx(), unmark_long_term_field_for_reference_by_frame_idx(), and unmark_long_term_frame_for_reference_by_frame_idx().
| static void unmark_for_reference | ( | FrameStore * | fs | ) | [static] |
mark FrameStore unused for reference
Definition at line 684 of file mbuffer.c.
References frame_store::bottom_field, frame_store::frame, free_mem4Dpel(), free_mem5Dpel(), storable_picture::imgUV_sub, storable_picture::imgY_sub, frame_store::is_reference, frame_store::is_used, storable_picture::motion, frame_store::top_field, and storable_picture::used_for_reference.
Referenced by flush_dpb(), mm_unmark_all_short_term_for_reference(), mm_unmark_short_term_for_reference(), and sliding_window_memory_management().

| static void unmark_long_term_field_for_reference_by_frame_idx | ( | PictureStructure | structure, | |
| int | long_term_frame_idx, | |||
| int | mark_current, | |||
| unsigned | curr_frame_num, | |||
| int | curr_pic_num | |||
| ) | [static] |
Mark a long-term reference field unused for reference only if it's not the complementary field of the picture indicated by picNumX.
Definition at line 1964 of file mbuffer.c.
References frame_store::frame_num, decoded_picture_buffer::fs_ltref, frame_store::is_long_term, decoded_picture_buffer::last_picture, frame_store::long_term_frame_idx, decoded_picture_buffer::ltref_frames_in_buffer, and unmark_for_long_term_reference().
Referenced by mm_assign_long_term_frame_idx(), and mm_mark_current_picture_long_term().

| static void unmark_long_term_frame_for_reference_by_frame_idx | ( | int | long_term_frame_idx | ) | [static] |
Mark a long-term reference frame or complementary field pair unused for referemce.
Definition at line 1947 of file mbuffer.c.
References decoded_picture_buffer::fs_ltref, frame_store::long_term_frame_idx, decoded_picture_buffer::ltref_frames_in_buffer, and unmark_for_long_term_reference().
Referenced by mm_assign_long_term_frame_idx(), and mm_mark_current_picture_long_term().

| void update_ltref_list | ( | void | ) |
Update the list of frame stores that contain long-term reference frames/fields.
Definition at line 1699 of file mbuffer.c.
References decoded_picture_buffer::fs, decoded_picture_buffer::fs_ltref, is_long_term_reference(), decoded_picture_buffer::ltref_frames_in_buffer, decoded_picture_buffer::size, and decoded_picture_buffer::used_size.
Referenced by adaptive_memory_management(), idr_memory_management(), replace_top_pic_with_frame(), and store_picture_in_dpb().

| void update_ref_list | ( | void | ) |
Update the list of frame stores that contain reference frames/fields.
Definition at line 1671 of file mbuffer.c.
References decoded_picture_buffer::fs, decoded_picture_buffer::fs_ref, is_short_term_reference(), decoded_picture_buffer::ref_frames_in_buffer, decoded_picture_buffer::size, and decoded_picture_buffer::used_size.
Referenced by adaptive_memory_management(), idr_memory_management(), mm_unmark_all_short_term_for_reference(), replace_top_pic_with_frame(), sliding_window_memory_management(), and store_picture_in_dpb().

| ColocatedParams* Co_located_JV[MAX_PLANE] = { NULL, NULL, NULL } |