| 113 | s->color_octets[i][7] == distinct_values[x]) |
| 114 | |
| 115 | static void smc_encode_stream(SMCContext *s, const AVFrame *frame, |
| 116 | PutByteContext *pb) |
| 117 | { |
| 118 | const uint8_t *src_pixels = (const uint8_t *)frame->data[0]; |
| 119 | const ptrdiff_t stride = frame->linesize[0]; |
| 120 | const uint8_t *prev_pixels = (const uint8_t *)s->prev_frame->data[0]; |
| 121 | const ptrdiff_t prev_stride = s->prev_frame->linesize[0]; |
| 122 | uint8_t *distinct_values = s->distinct_values; |
| 123 | const uint8_t *pixel_ptr, *row_ptr; |
| 124 | const int height = frame->height; |
| 125 | const int width = frame->width; |
| 126 | int block_counter = 0; |
| 127 | int color_pair_index = 0; |
| 128 | int color_quad_index = 0; |
| 129 | int color_octet_index = 0; |
| 130 | int color_table_index; /* indexes to color pair, quad, or octet tables */ |
| 131 | int total_blocks; |
| 132 | int cur_y = 0; |
| 133 | int cur_x = 0; |
| 134 | |
| 135 | /* Number of 4x4 blocks in frame. */ |
| 136 | total_blocks = ((width + 3) / 4) * ((height + 3) / 4); |
| 137 | |
| 138 | pixel_ptr = row_ptr = src_pixels; |
| 139 | |
| 140 | while (block_counter < total_blocks) { |
| 141 | const uint8_t *xpixel_ptr = pixel_ptr; |
| 142 | const uint8_t *xrow_ptr = row_ptr; |
| 143 | int intra_skip_blocks = 0; |
| 144 | int inter_skip_blocks = 0; |
| 145 | int coded_distinct = 0; |
| 146 | int coded_blocks = 0; |
| 147 | int cache_index; |
| 148 | int distinct = 0; |
| 149 | int blocks = 0; |
| 150 | int frame_y = cur_y; |
| 151 | int frame_x = cur_x; |
| 152 | |
| 153 | while (prev_pixels && s->key_frame == 0 && block_counter + inter_skip_blocks < total_blocks) { |
| 154 | const int y_size = FFMIN(4, height - cur_y); |
| 155 | const int x_size = FFMIN(4, width - cur_x); |
| 156 | int compare = 0; |
| 157 | |
| 158 | for (int y = 0; y < y_size; y++) { |
| 159 | const uint8_t *prev_pixel_ptr = prev_pixels + (y + cur_y) * prev_stride + cur_x; |
| 160 | |
| 161 | compare |= !!memcmp(prev_pixel_ptr, pixel_ptr + y * stride, x_size); |
| 162 | if (compare) |
| 163 | break; |
| 164 | } |
| 165 | |
| 166 | if (compare) |
| 167 | break; |
| 168 | |
| 169 | inter_skip_blocks++; |
| 170 | if (inter_skip_blocks >= 256) |
| 171 | break; |
| 172 |
no test coverage detected