Fixed inter_get_mv_cand and added new define ENABLE_TEMPORAL_MVP

This commit is contained in:
Marko Viitanen 2013-09-18 10:15:05 +03:00
parent 48581bdad8
commit c87d3870ce
3 changed files with 13 additions and 5 deletions

View file

@ -646,7 +646,7 @@ void encode_seq_parameter_set(encoder_control* encoder)
WRITE_U(encoder->stream, 0, 1, "long_term_ref_pics_present_flag"); WRITE_U(encoder->stream, 0, 1, "long_term_ref_pics_present_flag");
//IF long_term_ref_pics_present //IF long_term_ref_pics_present
//ENDIF //ENDIF
WRITE_U(encoder->stream, 0, 1, "sps_temporal_mvp_enable_flag"); WRITE_U(encoder->stream, ENABLE_TEMPORAL_MVP, 1, "sps_temporal_mvp_enable_flag");
WRITE_U(encoder->stream, 0, 1, "sps_strong_intra_smoothing_enable_flag"); WRITE_U(encoder->stream, 0, 1, "sps_strong_intra_smoothing_enable_flag");
@ -823,7 +823,7 @@ void encode_slice_data(encoder_control* encoder)
void encode_coding_tree(encoder_control* encoder,uint16_t xCtb,uint16_t yCtb, uint8_t depth) void encode_coding_tree(encoder_control* encoder,uint16_t xCtb,uint16_t yCtb, uint8_t depth)
{ {
CU_info *cur_CU = &encoder->in.cur_pic->CU[depth][xCtb+yCtb*(encoder->in.width_in_LCU<<MAX_DEPTH)]; CU_info *cur_CU = &encoder->in.cur_pic->CU[depth][xCtb+yCtb*(encoder->in.width_in_LCU<<MAX_DEPTH)];
uint8_t split_flag = cur_CU->split;//(depth<1)?1:0; /* TODO: get from CU data */ uint8_t split_flag = cur_CU->split;
uint8_t split_model = 0; uint8_t split_model = 0;
/* Check for slice border */ /* Check for slice border */

View file

@ -27,6 +27,8 @@
#define ENABLE_SIGN_HIDING 0 /*!< DOES NOT WORK PROPERLY */ #define ENABLE_SIGN_HIDING 0 /*!< DOES NOT WORK PROPERLY */
#define ENABLE_SCALING_LIST 1 /*!< Enable usage of (default) scaling list (BREAKS CHROMA WHEN 0!) */ #define ENABLE_SCALING_LIST 1 /*!< Enable usage of (default) scaling list (BREAKS CHROMA WHEN 0!) */
#define ENABLE_TEMPORAL_MVP 0 /*!< Enable usage of temporal Motion Vector Prediction */
/* END OF CONFIG VARIABLES */ /* END OF CONFIG VARIABLES */
#define MAX_REF_PIC_COUNT 5 #define MAX_REF_PIC_COUNT 5

View file

@ -165,12 +165,11 @@ void inter_recon(picture* ref,int32_t xpos, int32_t ypos,int32_t width, int16_t
void inter_get_mv_cand(encoder_control *encoder,int32_t xCtb, int32_t yCtb,int8_t depth, int16_t mv_cand[2][2]) void inter_get_mv_cand(encoder_control *encoder,int32_t xCtb, int32_t yCtb,int8_t depth, int16_t mv_cand[2][2])
{ {
uint8_t cur_block_in_scu = (LCU_WIDTH>>depth) / CU_MIN_SIZE_PIXELS; uint8_t cur_block_in_scu = (LCU_WIDTH>>depth) / CU_MIN_SIZE_PIXELS;
CU_info *cur_cu = &encoder->in.cur_pic->CU[depth][xCtb+yCtb*(encoder->in.width_in_LCU<<MAX_DEPTH)];
uint8_t candidates = 0; uint8_t candidates = 0;
/* /*
Predictor block locations Predictor block locations
____ ______ ____ _______
|B2|______|B1|B0| |B2|______|B1|B0|
| | | |
| Cur CU | | Cur CU |
@ -230,11 +229,18 @@ void inter_get_mv_cand(encoder_control *encoder,int32_t xCtb, int32_t yCtb,int8_
candidates++; candidates++;
} }
/* Remove identical candidate */
if(candidates == 2 && mv_cand[0][0] == mv_cand[1][0] && mv_cand[0][1] == mv_cand[1][1]) {
candidates = 1;
}
#if ENABLE_TEMPORAL_MVP
if(candidates < 2) { if(candidates < 2) {
//TODO: add temporal mv predictor //TODO: add temporal mv predictor
} }
#endif
for (;candidates < 2; candidates++) { while (candidates < 2) {
mv_cand[candidates][0] = 0; mv_cand[candidates][0] = 0;
mv_cand[candidates][1] = 0; mv_cand[candidates][1] = 0;
candidates++; candidates++;