-// if (s->all_fragments[i].coding_method == MODE_INTRA) {
-
- /* sort out the motion vector */
- motion_x = x + s->all_fragments[i].motion_x;
- motion_y = y + s->all_fragments[i].motion_y;
- motion_halfpel_index = s->all_fragments[i].motion_halfpel_index;
-
- if (motion_x < 0)
- motion_x = 0;
- if (motion_y < 0)
- motion_y = 0;
- if (motion_x > motion_x_limit)
- motion_x = motion_x_limit;
- if (motion_y > motion_y_limit)
- motion_y = motion_y_limit;
+
+ motion_source = s->all_fragments[i].first_pixel;
+ motion_halfpel_index = 0;
+
+ /* sort out the motion vector if this fragment is coded
+ * using a motion vector method */
+ if ((s->all_fragments[i].coding_method > MODE_INTRA) &&
+ (s->all_fragments[i].coding_method != MODE_USING_GOLDEN)) {
+ motion_x = s->all_fragments[i].motion_x;
+ motion_y = s->all_fragments[i].motion_y;
+if ((motion_x == 0xbeef) || (motion_y == 0xbeef))
+printf (" help! got beefy vector! (%X, %X)\n", motion_x, motion_y);
+
+ if (motion_x >= 0) {
+ motion_halfpel_index = motion_x & 0x01;
+ motion_source += (motion_x >> 1);
+ } else {
+ motion_x = -motion_x;
+ motion_halfpel_index = motion_x & 0x01;
+ motion_source -= ((motion_x + 1) >> 1);
+ }
+
+// motion_y = -motion_y;
+ if (motion_y >= 0) {
+ motion_halfpel_index |= (motion_y & 0x01) << 1;
+ motion_source += ((motion_y >> 1) * stride);
+ } else {
+ motion_y = -motion_y;
+ motion_halfpel_index |= (motion_y & 0x01) << 1;
+ motion_source -= (((motion_y + 1) >> 1) * stride);
+ }
+
+ /* if the are any problems with a motion vector, refuse
+ * to render the block */
+ if ((motion_source < upper_motion_limit) ||
+ (motion_source > lower_motion_limit)) {
+// printf (" vp3: help! motion source (%d) out of range (%d..%d)\n",
+// motion_source, upper_motion_limit, lower_motion_limit);
+ continue;
+ }
+ }