| 76 | } IpvideoContext; |
| 77 | |
| 78 | static int copy_from(IpvideoContext *s, AVFrame *src, AVFrame *dst, int delta_x, int delta_y) |
| 79 | { |
| 80 | int width = dst->width; |
| 81 | int current_offset = s->pixel_ptr - dst->data[0]; |
| 82 | int x = (current_offset % dst->linesize[0]) / (1 + s->is_16bpp); |
| 83 | int y = current_offset / dst->linesize[0]; |
| 84 | int dx = delta_x + x - ((delta_x + x >= width) - (delta_x + x < 0)) * width; |
| 85 | int dy = delta_y + y + (delta_x + x >= width) - (delta_x + x < 0); |
| 86 | int motion_offset = dy * src->linesize[0] + dx * (1 + s->is_16bpp); |
| 87 | |
| 88 | if (motion_offset < 0) { |
| 89 | av_log(s->avctx, AV_LOG_ERROR, "motion offset < 0 (%d)\n", motion_offset); |
| 90 | return AVERROR_INVALIDDATA; |
| 91 | } else if (motion_offset > s->upper_motion_limit_offset) { |
| 92 | av_log(s->avctx, AV_LOG_ERROR, "motion offset above limit (%d >= %d)\n", |
| 93 | motion_offset, s->upper_motion_limit_offset); |
| 94 | return AVERROR_INVALIDDATA; |
| 95 | } |
| 96 | if (!src->data[0]) { |
| 97 | av_log(s->avctx, AV_LOG_ERROR, "Invalid decode type, corrupted header?\n"); |
| 98 | return AVERROR(EINVAL); |
| 99 | } |
| 100 | s->hdsp.put_pixels_tab[!s->is_16bpp][0](s->pixel_ptr, src->data[0] + motion_offset, |
| 101 | dst->linesize[0], 8); |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | static int ipvideo_decode_block_opcode_0x0(IpvideoContext *s, AVFrame *frame) |
| 106 | { |
no test coverage detected