Replace golden and altref by past and future in RefFrameType. So that we don't get confused with FrameType and RefFrameType.
Unified · Split
| @@ -133,15 +133,15 @@ static INLINE vpx_rational_t invert_vpx_rational(vpx_rational_t v) { · 132 unmodified lines | |||
| 133 | static INLINE FrameType | 133 | static INLINE FrameType |
| 134 | get_frame_type_from_update_type(FRAME_UPDATE_TYPE update_type) { | 134 | get_frame_type_from_update_type(FRAME_UPDATE_TYPE update_type) { |
| 135 | switch (update_type) { | 135 | switch (update_type) { |
| 136 | case KF_UPDATE: return kKeyFrame; | 136 | case KF_UPDATE: return kFrameTypeKey; |
| 137 | case ARF_UPDATE: return kAlternateReference; | 137 | case ARF_UPDATE: return kFrameTypeAltRef; |
| 138 | case GF_UPDATE: return kGoldenFrame; | 138 | case GF_UPDATE: return kFrameTypeGolden; |
| 139 | case OVERLAY_UPDATE: return kOverlayFrame; | 139 | case OVERLAY_UPDATE: return kFrameTypeOverlay; |
| 140 | case LF_UPDATE: return kInterFrame; | 140 | case LF_UPDATE: return kFrameTypeInter; |
| 141 | default: | 141 | default: |
| 142 | fprintf(stderr, "Unsupported update_type %d\n", update_type); | 142 | fprintf(stderr, "Unsupported update_type %d\n", update_type); |
| 143 | abort(); | 143 | abort(); |
| 144 | return kInterFrame; | 144 | return kFrameTypeInter; |
| 145 | } | 145 | } |
| 146 | } | 146 | } |
| 147 | 147 | ||
| @@ -161,19 +161,35 @@ static void update_partition_info(const PARTITION_INFO *input_partition_info, · 13 unmodified lines | |||
| 161 | } | 161 | } |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | // translate MV_REFERENCE_FRAME to RefFrameType | ||
| 165 | static RefFrameType mv_ref_frame_to_ref_frame_type( | ||
| 166 | MV_REFERENCE_FRAME mv_ref_frame) { | ||
| 167 | switch (mv_ref_frame) { | ||
| 168 | case LAST_FRAME: return kRefFrameTypeLast; | ||
| 169 | case GOLDEN_FRAME: return kRefFrameTypePast; | ||
| 170 | case ALTREF_FRAME: return kRefFrameTypeFuture; | ||
| 171 | default: return kRefFrameTypeNone; | ||
| 172 | } | ||
| 173 | } | ||
| 174 | |||
| 164 | static void update_motion_vector_info( | 175 | static void update_motion_vector_info( |
| 165 | const MOTION_VECTOR_INFO *input_motion_vector_info, const int num_rows_4x4, | 176 | const MOTION_VECTOR_INFO *input_motion_vector_info, const int num_rows_4x4, |
| 166 | const int num_cols_4x4, MotionVectorInfo *output_motion_vector_info) { | 177 | const int num_cols_4x4, MotionVectorInfo *output_motion_vector_info) { |
| 167 | const int num_units_4x4 = num_rows_4x4 * num_cols_4x4; | 178 | const int num_units_4x4 = num_rows_4x4 * num_cols_4x4; |
| 168 | for (int i = 0; i < num_units_4x4; ++i) { | 179 | for (int i = 0; i < num_units_4x4; ++i) { |
| 180 | const MV_REFERENCE_FRAME *in_ref_frame = | ||
| 181 | input_motion_vector_info[i].ref_frame; | ||
| 169 | output_motion_vector_info[i].mv_count = | 182 | output_motion_vector_info[i].mv_count = |
| 170 | (input_motion_vector_info[i].ref_frame[0] == INTRA_FRAME) | 183 | (in_ref_frame[0] == INTRA_FRAME) ? 0 |
| 171 | ? 0 | 184 | : ((in_ref_frame[1] == NONE) ? 1 : 2); |
| 172 | : ((input_motion_vector_info[i].ref_frame[1] == -1) ? 1 : 2); | 185 | if (in_ref_frame[0] == NONE) { |
| 186 | fprintf(stderr, "in_ref_frame[0] shouldn't be NONE\n"); | ||
| 187 | abort(); | ||
| 188 | } | ||
| 173 | output_motion_vector_info[i].ref_frame[0] = | 189 | output_motion_vector_info[i].ref_frame[0] = |
| 174 | static_cast<RefFrameType>(input_motion_vector_info[i].ref_frame[0]); | 190 | mv_ref_frame_to_ref_frame_type(in_ref_frame[0]); |
| 175 | output_motion_vector_info[i].ref_frame[1] = | 191 | output_motion_vector_info[i].ref_frame[1] = |
| 176 | static_cast<RefFrameType>(input_motion_vector_info[i].ref_frame[1]); | 192 | mv_ref_frame_to_ref_frame_type(in_ref_frame[1]); |
| 177 | output_motion_vector_info[i].mv_row[0] = | 193 | output_motion_vector_info[i].mv_row[0] = |
| 178 | (double)input_motion_vector_info[i].mv[0].as_mv.row / | 194 | (double)input_motion_vector_info[i].mv[0].as_mv.row / |
| 179 | kMotionVectorPrecision; | 195 | kMotionVectorPrecision; |
| @@ -523,12 +539,12 @@ static void SetGroupOfPicture(int first_is_key_frame, int use_alt_ref, · 343 unmodified lines | |||
| 523 | // frame. | 539 | // frame. |
| 524 | EncodeFrameInfo encode_frame_info; | 540 | EncodeFrameInfo encode_frame_info; |
| 525 | if (first_is_key_frame) { | 541 | if (first_is_key_frame) { |
| 526 | encode_frame_info.frame_type = kKeyFrame; | 542 | encode_frame_info.frame_type = kFrameTypeKey; |
| 527 | } else { | 543 | } else { |
| 528 | if (last_gop_use_alt_ref) { | 544 | if (last_gop_use_alt_ref) { |
| 529 | encode_frame_info.frame_type = kOverlayFrame; | 545 | encode_frame_info.frame_type = kFrameTypeOverlay; |
| 530 | } else { | 546 | } else { |
| 531 | encode_frame_info.frame_type = kGoldenFrame; | 547 | encode_frame_info.frame_type = kFrameTypeGolden; |
| 532 | } | 548 | } |
| 533 | } | 549 | } |
| 534 | encode_frame_info.show_idx = first_show_idx; | 550 | encode_frame_info.show_idx = first_show_idx; |
| @@ -541,7 +557,7 @@ static void SetGroupOfPicture(int first_is_key_frame, int use_alt_ref, · 6 unmodified lines | |||
| 541 | // If there is alternate reference, it is always coded at the second place. | 557 | // If there is alternate reference, it is always coded at the second place. |
| 542 | // Its show index (or timestamp) is at the last of this group | 558 | // Its show index (or timestamp) is at the last of this group |
| 543 | EncodeFrameInfo encode_frame_info; | 559 | EncodeFrameInfo encode_frame_info; |
| 544 | encode_frame_info.frame_type = kAlternateReference; | 560 | encode_frame_info.frame_type = kFrameTypeAltRef; |
| 545 | encode_frame_info.show_idx = first_show_idx + show_frame_count; | 561 | encode_frame_info.show_idx = first_show_idx + show_frame_count; |
| 546 | encode_frame_info.coding_index = start_coding_index + 1; | 562 | encode_frame_info.coding_index = start_coding_index + 1; |
| 547 | group_of_picture->encode_frame_list.push_back(encode_frame_info); | 563 | group_of_picture->encode_frame_list.push_back(encode_frame_info); |
| @@ -550,7 +566,7 @@ static void SetGroupOfPicture(int first_is_key_frame, int use_alt_ref, · 2 unmodified lines | |||
| 550 | // Encode the rest show inter frames. | 566 | // Encode the rest show inter frames. |
| 551 | for (int i = 1; i < show_frame_count; ++i) { | 567 | for (int i = 1; i < show_frame_count; ++i) { |
| 552 | EncodeFrameInfo encode_frame_info; | 568 | EncodeFrameInfo encode_frame_info; |
| 553 | encode_frame_info.frame_type = kInterFrame; | 569 | encode_frame_info.frame_type = kFrameTypeInter; |
| 554 | encode_frame_info.show_idx = first_show_idx + i; | 570 | encode_frame_info.show_idx = first_show_idx + i; |
| 555 | encode_frame_info.coding_index = start_coding_index + use_alt_ref + i; | 571 | encode_frame_info.coding_index = start_coding_index + use_alt_ref + i; |
| 556 | group_of_picture->encode_frame_list.push_back(encode_frame_info); | 572 | group_of_picture->encode_frame_list.push_back(encode_frame_info); |
| @@ -19,22 +19,24 @@ · 18 unmodified lines | |||
| 19 | 19 | ||
| 20 | namespace vp9 { | 20 | namespace vp9 { |
| 21 | 21 | ||
| 22 | // TODO(angiebird): Add description for each frame type. | ||
| 22 | enum FrameType { | 23 | enum FrameType { |
| 23 | kKeyFrame = 0, | 24 | kFrameTypeKey = 0, |
| 24 | kInterFrame, | 25 | kFrameTypeInter, |
| 25 | kAlternateReference, | 26 | kFrameTypeAltRef, |
| 26 | kOverlayFrame, | 27 | kFrameTypeOverlay, |
| 27 | kGoldenFrame, | 28 | kFrameTypeGolden, |
| 28 | }; | 29 | }; |
| 29 | 30 | ||
| 30 | // The enum type is similar to vp9: |MV_REFERENCE_FRAME|. | 31 | // TODO(angiebird): Add description for each reference frame type. |
| 31 | // TODO(angiebird): Clarify the difference between FrameType and RefFrameType. | 32 | // This enum numbers have to be contiguous and start from zero except |
| 33 | // kNoneRefFrame. | ||
| 32 | enum RefFrameType { | 34 | enum RefFrameType { |
| 33 | kIntraRefFrame = 0, | 35 | kRefFrameTypeLast = 0, |
| 34 | kLastRefFrame = 1, | 36 | kRefFrameTypePast = 1, |
| 35 | kGoldenRefFrame = 2, | 37 | kRefFrameTypeFuture = 2, |
| 36 | kAltRefFrame = 3, | 38 | kRefFrameTypeMax = 3, |
| 37 | kNoneRefRefFrame = -1, | 39 | kRefFrameTypeNone = -1, |
| 38 | }; | 40 | }; |
| 39 | 41 | ||
| 40 | // The frame is split to 4x4 blocks. | 42 | // The frame is split to 4x4 blocks. |