44 switch (
s->pict_type) {
49 return s->f_code + 15;
51 return FFMAX3(
s->f_code,
s->b_code, 2) + 15;
59 int c_wrap, c_xy, l_wrap, l_xy;
61 l_wrap =
s->b8_stride;
62 l_xy = (2 *
s->mb_y - 1) * l_wrap +
s->mb_x * 2 - 1;
63 c_wrap =
s->mb_stride;
64 c_xy = (
s->mb_y - 1) * c_wrap +
s->mb_x - 1;
67 memset(
s->ac_val[0] + l_xy, 0, (l_wrap * 2 + 1) * 16 *
sizeof(int16_t));
68 memset(
s->ac_val[1] + c_xy, 0, (c_wrap + 1) * 16 *
sizeof(int16_t));
69 memset(
s->ac_val[2] + c_xy, 0, (c_wrap + 1) * 16 *
sizeof(int16_t));
76 s->last_mv[1][0][1] = 0;
79 #define tab_size ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0]))
80 #define tab_bias (tab_size / 2)
87 s->direct_scale_mv[0][
i] = (
i -
tab_bias) *
s->pb_time /
s->pp_time;
88 s->direct_scale_mv[1][
i] = (
i -
tab_bias) * (
s->pb_time -
s->pp_time) /
96 int xy =
s->block_index[
i];
97 uint16_t time_pp =
s->pp_time;
98 uint16_t time_pb =
s->pb_time;
101 p_mx =
s->next_pic.motion_val[0][xy][0];
103 s->mv[0][
i][0] =
s->direct_scale_mv[0][p_mx +
tab_bias] +
mx;
104 s->mv[1][
i][0] =
mx ?
s->mv[0][
i][0] - p_mx
105 :
s->direct_scale_mv[1][p_mx +
tab_bias];
107 s->mv[0][
i][0] = p_mx * time_pb / time_pp +
mx;
108 s->mv[1][
i][0] =
mx ?
s->mv[0][
i][0] - p_mx
109 : p_mx * (time_pb - time_pp) / time_pp;
111 p_my =
s->next_pic.motion_val[0][xy][1];
113 s->mv[0][
i][1] =
s->direct_scale_mv[0][p_my +
tab_bias] +
my;
114 s->mv[1][
i][1] =
my ?
s->mv[0][
i][1] - p_my
115 :
s->direct_scale_mv[1][p_my +
tab_bias];
117 s->mv[0][
i][1] = p_my * time_pb / time_pp +
my;
118 s->mv[1][
i][1] =
my ?
s->mv[0][
i][1] - p_my
119 : p_my * (time_pb - time_pp) / time_pp;
131 const int mb_index =
s->mb_x +
s->mb_y *
s->mb_stride;
132 const int colocated_mb_type =
s->next_pic.mb_type[mb_index];
140 if (
IS_8X8(colocated_mb_type)) {
142 for (
i = 0;
i < 4;
i++)
147 for (
i = 0;
i < 2;
i++) {
148 int field_select =
s->next_pic.ref_index[0][4 * mb_index + 2 *
i];
149 s->field_select[0][
i] = field_select;
150 s->field_select[1][
i] =
i;
151 if (
s->top_field_first) {
152 time_pp =
s->pp_field_time - field_select +
i;
153 time_pb =
s->pb_field_time - field_select +
i;
155 time_pp =
s->pp_field_time + field_select -
i;
156 time_pb =
s->pb_field_time + field_select -
i;
158 s->mv[0][
i][0] =
s->p_field_mv_table[
i][0][mb_index][0] *
159 time_pb / time_pp +
mx;
160 s->mv[0][
i][1] =
s->p_field_mv_table[
i][0][mb_index][1] *
161 time_pb / time_pp +
my;
162 s->mv[1][
i][0] =
mx ?
s->mv[0][
i][0] -
163 s->p_field_mv_table[
i][0][mb_index][0]
164 :
s->p_field_mv_table[
i][0][mb_index][0] *
165 (time_pb - time_pp) / time_pp;
166 s->mv[1][
i][1] =
my ?
s->mv[0][
i][1] -
167 s->p_field_mv_table[
i][0][mb_index][1]
168 :
s->p_field_mv_table[
i][0][mb_index][1] *
169 (time_pb - time_pp) / time_pp;
177 s->mv[0][3][0] =
s->mv[0][0][0];
180 s->mv[0][3][1] =
s->mv[0][0][1];
183 s->mv[1][3][0] =
s->mv[1][0][0];
186 s->mv[1][3][1] =
s->mv[1][0][1];