MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / dv_encode_video_segment

Function dv_encode_video_segment

libavcodec/dv.c:943–1072  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

941}
942
943static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
944{
945 DVVideoContext *s = avctx->priv_data;
946 DVwork_chunk *work_chunk = arg;
947 int mb_index, i, j;
948 int mb_x, mb_y, c_offset, linesize, y_stride;
949 uint8_t* y_ptr;
950 uint8_t* dif;
951 uint8_t scratch[64];
952 EncBlockInfo enc_blks[5*DV_MAX_BPM];
953 PutBitContext pbs[5*DV_MAX_BPM];
954 PutBitContext* pb;
955 EncBlockInfo* enc_blk;
956 int vs_bit_size = 0;
957 int qnos[5] = {15, 15, 15, 15, 15}; /* No quantization */
958 int* qnosp = &qnos[0];
959
960 dif = &s->buf[work_chunk->buf_offset*80];
961 enc_blk = &enc_blks[0];
962 for (mb_index = 0; mb_index < 5; mb_index++) {
963 dv_calculate_mb_xy(s, work_chunk, mb_index, &mb_x, &mb_y);
964
965 /* initializing luminance blocks */
966 if ((s->sys->pix_fmt == PIX_FMT_YUV420P) ||
967 (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) ||
968 (s->sys->height >= 720 && mb_y != 134)) {
969 y_stride = s->picture.linesize[0] << 3;
970 } else {
971 y_stride = 16;
972 }
973 y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x) << 3);
974 linesize = s->picture.linesize[0];
975
976 if (s->sys->video_stype == 4) { /* SD 422 */
977 vs_bit_size +=
978 dv_init_enc_block(enc_blk+0, y_ptr , linesize, s, 0) +
979 dv_init_enc_block(enc_blk+1, NULL , linesize, s, 0) +
980 dv_init_enc_block(enc_blk+2, y_ptr + 8 , linesize, s, 0) +
981 dv_init_enc_block(enc_blk+3, NULL , linesize, s, 0);
982 } else {
983 vs_bit_size +=
984 dv_init_enc_block(enc_blk+0, y_ptr , linesize, s, 0) +
985 dv_init_enc_block(enc_blk+1, y_ptr + 8 , linesize, s, 0) +
986 dv_init_enc_block(enc_blk+2, y_ptr + y_stride, linesize, s, 0) +
987 dv_init_enc_block(enc_blk+3, y_ptr + 8 + y_stride, linesize, s, 0);
988 }
989 enc_blk += 4;
990
991 /* initializing chrominance blocks */
992 c_offset = (((mb_y >> (s->sys->pix_fmt == PIX_FMT_YUV420P)) * s->picture.linesize[1] +
993 (mb_x >> ((s->sys->pix_fmt == PIX_FMT_YUV411P) ? 2 : 1))) << 3);
994 for (j = 2; j; j--) {
995 uint8_t *c_ptr = s->picture.data[j] + c_offset;
996 linesize = s->picture.linesize[j];
997 y_stride = (mb_y == 134) ? 8 : (s->picture.linesize[j] << 3);
998 if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) {
999 uint8_t* d;
1000 uint8_t* b = scratch;

Callers

nothing calls this directly

Calls 9

dv_calculate_mb_xyFunction · 0.85
dv_init_enc_blockFunction · 0.85
dv_guess_qnosFunction · 0.85
init_put_bitsFunction · 0.85
put_sbitsFunction · 0.85
dv_encode_acFunction · 0.85
av_logFunction · 0.85
flush_put_bitsFunction · 0.85
put_bits_countFunction · 0.85

Tested by

no test coverage detected