| 351 | } |
| 352 | |
| 353 | static av_cold int h261_encode_init(AVCodecContext *avctx) |
| 354 | { |
| 355 | static AVOnce init_static_once = AV_ONCE_INIT; |
| 356 | H261EncContext *const h = avctx->priv_data; |
| 357 | MPVEncContext *const s = &h->s.s; |
| 358 | |
| 359 | if (avctx->width == 176 && avctx->height == 144) { |
| 360 | h->format = H261_QCIF; |
| 361 | } else if (avctx->width == 352 && avctx->height == 288) { |
| 362 | h->format = H261_CIF; |
| 363 | } else { |
| 364 | av_log(avctx, AV_LOG_ERROR, |
| 365 | "The specified picture size of %dx%d is not valid for the " |
| 366 | "H.261 codec.\nValid sizes are 176x144, 352x288\n", |
| 367 | avctx->width, avctx->height); |
| 368 | return AVERROR(EINVAL); |
| 369 | } |
| 370 | h->s.encode_picture_header = h261_encode_picture_header; |
| 371 | s->encode_mb = h261_encode_mb; |
| 372 | |
| 373 | s->min_qcoeff = -127; |
| 374 | s->max_qcoeff = 127; |
| 375 | s->ac_esc_length = H261_ESC_LEN; |
| 376 | |
| 377 | s->me.mv_penalty = mv_penalty; |
| 378 | |
| 379 | s->intra_ac_vlc_length = s->inter_ac_vlc_length = uni_h261_rl_len; |
| 380 | s->intra_ac_vlc_last_length = s->inter_ac_vlc_last_length = uni_h261_rl_len_last; |
| 381 | ff_thread_once(&init_static_once, h261_encode_init_static); |
| 382 | |
| 383 | return ff_mpv_encode_init(avctx); |
| 384 | } |
| 385 | |
| 386 | const FFCodec ff_h261_encoder = { |
| 387 | .p.name = "h261", |
nothing calls this directly
no test coverage detected