| 162 | } |
| 163 | |
| 164 | static av_cold int encode_init(AVCodecContext *avctx) |
| 165 | { |
| 166 | SnowEncContext *const enc = avctx->priv_data; |
| 167 | SnowContext *const s = &enc->com; |
| 168 | MPVEncContext *const mpv = &enc->m.s; |
| 169 | int plane_index, ret; |
| 170 | int i; |
| 171 | |
| 172 | if (enc->pred == DWT_97 |
| 173 | && (avctx->flags & AV_CODEC_FLAG_QSCALE) |
| 174 | && avctx->global_quality == 0){ |
| 175 | av_log(avctx, AV_LOG_ERROR, "The 9/7 wavelet is incompatible with lossless mode.\n"); |
| 176 | return AVERROR(EINVAL); |
| 177 | } |
| 178 | |
| 179 | s->spatial_decomposition_type = enc->pred; //FIXME add decorrelator type r transform_type |
| 180 | |
| 181 | s->mv_scale = (avctx->flags & AV_CODEC_FLAG_QPEL) ? 2 : 4; |
| 182 | s->block_max_depth= (avctx->flags & AV_CODEC_FLAG_4MV ) ? 1 : 0; |
| 183 | |
| 184 | for(plane_index=0; plane_index<3; plane_index++){ |
| 185 | s->plane[plane_index].diag_mc= 1; |
| 186 | s->plane[plane_index].htaps= 6; |
| 187 | s->plane[plane_index].hcoeff[0]= 40; |
| 188 | s->plane[plane_index].hcoeff[1]= -10; |
| 189 | s->plane[plane_index].hcoeff[2]= 2; |
| 190 | s->plane[plane_index].fast_mc= 1; |
| 191 | } |
| 192 | |
| 193 | // Must be before ff_snow_common_init() |
| 194 | ff_hpeldsp_init(&s->hdsp, avctx->flags); |
| 195 | if ((ret = ff_snow_common_init(avctx)) < 0) { |
| 196 | return ret; |
| 197 | } |
| 198 | |
| 199 | #define mcf(dx,dy)\ |
| 200 | enc->qdsp.put_qpel_pixels_tab [0][dy+dx/4]=\ |
| 201 | enc->qdsp.put_no_rnd_qpel_pixels_tab[0][dy+dx/4]=\ |
| 202 | s->h264qpel.put_h264_qpel_pixels_tab[0][dy+dx/4];\ |
| 203 | enc->qdsp.put_qpel_pixels_tab [1][dy+dx/4]=\ |
| 204 | enc->qdsp.put_no_rnd_qpel_pixels_tab[1][dy+dx/4]=\ |
| 205 | s->h264qpel.put_h264_qpel_pixels_tab[1][dy+dx/4]; |
| 206 | |
| 207 | mcf( 0, 0) |
| 208 | mcf( 4, 0) |
| 209 | mcf( 8, 0) |
| 210 | mcf(12, 0) |
| 211 | mcf( 0, 4) |
| 212 | mcf( 4, 4) |
| 213 | mcf( 8, 4) |
| 214 | mcf(12, 4) |
| 215 | mcf( 0, 8) |
| 216 | mcf( 4, 8) |
| 217 | mcf( 8, 8) |
| 218 | mcf(12, 8) |
| 219 | mcf( 0,12) |
| 220 | mcf( 4,12) |
| 221 | mcf( 8,12) |
nothing calls this directly
no test coverage detected