Unified · Split
| @@ -115,7 +115,7 @@ static int put_audio_specific_config(AVCodecContext *avctx) · 114 unmodified lines | |||
| 115 | put_bits(&pb, 5, AOT_SBR); | 115 | put_bits(&pb, 5, AOT_SBR); |
| 116 | put_bits(&pb, 1, 0); | 116 | put_bits(&pb, 1, 0); |
| 117 | flush_put_bits(&pb); | 117 | flush_put_bits(&pb); |
| 118 | avctx->extradata_size = put_bits_count(&pb) >> 3; | 118 | avctx->extradata_size = put_bytes_output(&pb); |
| 119 | 119 | ||
| 120 | return 0; | 120 | return 0; |
| 121 | } | 121 | } |
| @@ -881,6 +881,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 759 unmodified lines | |||
| 881 | flush_put_bits(&s->pb); | 881 | flush_put_bits(&s->pb); |
| 882 | 882 | ||
| 883 | s->last_frame_pb_count = put_bits_count(&s->pb); | 883 | s->last_frame_pb_count = put_bits_count(&s->pb); |
| 884 | avpkt->size = put_bytes_output(&s->pb); | ||
| 884 | 885 | ||
| 885 | s->lambda_sum += s->lambda; | 886 | s->lambda_sum += s->lambda; |
| 886 | s->lambda_count++; | 887 | s->lambda_count++; |
| @@ -888,7 +889,6 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 1 unmodified line | |||
| 888 | ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts, | 889 | ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts, |
| 889 | &avpkt->duration); | 890 | &avpkt->duration); |
| 890 | 891 | ||
| 891 | avpkt->size = put_bits_count(&s->pb) >> 3; | ||
| 892 | *got_packet_ptr = 1; | 892 | *got_packet_ptr = 1; |
| 893 | return 0; | 893 | return 0; |
| 894 | } | 894 | } |
| @@ -485,7 +485,7 @@ static int write_frame(AlacEncodeContext *s, AVPacket *avpkt, · 484 unmodified lines | |||
| 485 | put_bits(pb, 3, TYPE_END); | 485 | put_bits(pb, 3, TYPE_END); |
| 486 | flush_put_bits(pb); | 486 | flush_put_bits(pb); |
| 487 | 487 | ||
| 488 | return put_bits_count(pb) >> 3; | 488 | return put_bytes_output(pb); |
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | static av_always_inline int get_max_frame_size(int frame_size, int ch, int bps) | 491 | static av_always_inline int get_max_frame_size(int frame_size, int ch, int bps) |
| @@ -290,7 +290,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 289 unmodified lines | |||
| 290 | else | 290 | else |
| 291 | flush_put_bits_le(&a->pb); | 291 | flush_put_bits_le(&a->pb); |
| 292 | AV_WN32(put_bits_ptr(&a->pb), 0); | 292 | AV_WN32(put_bits_ptr(&a->pb), 0); |
| 293 | size = (put_bits_count(&a->pb) + 31) / 32; | 293 | size = (put_bytes_output(&a->pb) + 3) / 4; |
| 294 | 294 | ||
| 295 | if (avctx->codec_id == AV_CODEC_ID_ASV1) { | 295 | if (avctx->codec_id == AV_CODEC_ID_ASV1) { |
| 296 | a->bbdsp.bswap_buf((uint32_t *) pkt->data, | 296 | a->bbdsp.bswap_buf((uint32_t *) pkt->data, |
| @@ -346,7 +346,7 @@ static int cbs_write_unit_data(CodedBitstreamContext *ctx, · 345 unmodified lines | |||
| 346 | 346 | ||
| 347 | flush_put_bits(&pbc); | 347 | flush_put_bits(&pbc); |
| 348 | 348 | ||
| 349 | ret = ff_cbs_alloc_unit_data(unit, put_bits_count(&pbc) / 8); | 349 | ret = ff_cbs_alloc_unit_data(unit, put_bytes_output(&pbc)); |
| 350 | if (ret < 0) | 350 | if (ret < 0) |
| 351 | return ret; | 351 | return ret; |
| 352 | 352 | ||
| @@ -766,7 +766,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 765 unmodified lines | |||
| 766 | put_bits(pb, cb[512].size, cb[512].bits); | 766 | put_bits(pb, cb[512].size, cb[512].bits); |
| 767 | 767 | ||
| 768 | flush_put_bits(pb); | 768 | flush_put_bits(pb); |
| 769 | bytestream2_skip_p(pby, put_bits_count(pb) >> 3); | 769 | bytestream2_skip_p(pby, put_bytes_output(pb)); |
| 770 | padd = (4 - (bytestream2_tell_p(pby) & 3)) & 3; | 770 | padd = (4 - (bytestream2_tell_p(pby) & 3)) & 3; |
| 771 | while (padd--) | 771 | while (padd--) |
| 772 | bytestream2_put_byte(pby, 0); | 772 | bytestream2_put_byte(pby, 0); |
| @@ -89,7 +89,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 88 unmodified lines | |||
| 89 | 89 | ||
| 90 | flush_put_bits(&pb); | 90 | flush_put_bits(&pb); |
| 91 | 91 | ||
| 92 | pkt->size = put_bits_count(&pb) / 8; | 92 | pkt->size = put_bytes_output(&pb); |
| 93 | pkt->flags |= AV_PKT_FLAG_KEY; | 93 | pkt->flags |= AV_PKT_FLAG_KEY; |
| 94 | *got_packet = 1; | 94 | *got_packet = 1; |
| 95 | return 0; | 95 | return 0; |
| @@ -82,7 +82,7 @@ int avpriv_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, · 81 unmodified lines | |||
| 82 | put_bits(&pb, 14, tmp); | 82 | put_bits(&pb, 14, tmp); |
| 83 | } | 83 | } |
| 84 | flush_put_bits(&pb); | 84 | flush_put_bits(&pb); |
| 85 | return (put_bits_count(&pb) + 7) >> 3; | 85 | return put_bytes_output(&pb); |
| 86 | default: | 86 | default: |
| 87 | return AVERROR_INVALIDDATA; | 87 | return AVERROR_INVALIDDATA; |
| 88 | } | 88 | } |
| @@ -1213,8 +1213,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 1212 unmodified lines | |||
| 1213 | flush_put_bits(&c->pb); | 1213 | flush_put_bits(&c->pb); |
| 1214 | 1214 | ||
| 1215 | avpkt->pts = frame->pts; | 1215 | avpkt->pts = frame->pts; |
| 1216 | avpkt->size = put_bytes_output(&c->pb); | ||
| 1216 | avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); | 1217 | avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); |
| 1217 | avpkt->size = put_bits_count(&c->pb) >> 3; | ||
| 1218 | *got_packet_ptr = 1; | 1218 | *got_packet_ptr = 1; |
| 1219 | return 0; | 1219 | return 0; |
| 1220 | } | 1220 | } |
| @@ -1239,7 +1239,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 1238 unmodified lines | |||
| 1239 | bytes = ff_rac_terminate(&fs->c, 1); | 1239 | bytes = ff_rac_terminate(&fs->c, 1); |
| 1240 | } else { | 1240 | } else { |
| 1241 | flush_put_bits(&fs->pb); // FIXME: nicer padding | 1241 | flush_put_bits(&fs->pb); // FIXME: nicer padding |
| 1242 | bytes = fs->ac_byte_count + (put_bits_count(&fs->pb) + 7) / 8; | 1242 | bytes = fs->ac_byte_count + put_bytes_output(&fs->pb); |
| 1243 | } | 1243 | } |
| 1244 | if (i > 0 || f->version > 2) { | 1244 | if (i > 0 || f->version > 2) { |
| 1245 | av_assert0(bytes < pkt->size / f->slice_count); | 1245 | av_assert0(bytes < pkt->size / f->slice_count); |
| @@ -1234,7 +1234,7 @@ static void write_frame_header(FlacEncodeContext *s) · 1233 unmodified lines | |||
| 1234 | 1234 | ||
| 1235 | flush_put_bits(&s->pb); | 1235 | flush_put_bits(&s->pb); |
| 1236 | crc = av_crc(av_crc_get_table(AV_CRC_8_ATM), 0, s->pb.buf, | 1236 | crc = av_crc(av_crc_get_table(AV_CRC_8_ATM), 0, s->pb.buf, |
| 1237 | put_bits_count(&s->pb) >> 3); | 1237 | put_bytes_output(&s->pb)); |
| 1238 | put_bits(&s->pb, 8, crc); | 1238 | put_bits(&s->pb, 8, crc); |
| 1239 | } | 1239 | } |
| 1240 | 1240 | ||
| @@ -1304,7 +1304,7 @@ static void write_frame_footer(FlacEncodeContext *s) · 63 unmodified lines | |||
| 1304 | int crc; | 1304 | int crc; |
| 1305 | flush_put_bits(&s->pb); | 1305 | flush_put_bits(&s->pb); |
| 1306 | crc = av_bswap16(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, s->pb.buf, | 1306 | crc = av_bswap16(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, s->pb.buf, |
| 1307 | put_bits_count(&s->pb)>>3)); | 1307 | put_bytes_output(&s->pb))); |
| 1308 | put_bits(&s->pb, 16, crc); | 1308 | put_bits(&s->pb, 16, crc); |
| 1309 | flush_put_bits(&s->pb); | 1309 | flush_put_bits(&s->pb); |
| 1310 | } | 1310 | } |
| @@ -1316,7 +1316,7 @@ static int write_frame(FlacEncodeContext *s, AVPacket *avpkt) · 5 unmodified lines | |||
| 1316 | write_frame_header(s); | 1316 | write_frame_header(s); |
| 1317 | write_subframes(s); | 1317 | write_subframes(s); |
| 1318 | write_frame_footer(s); | 1318 | write_frame_footer(s); |
| 1319 | return put_bits_count(&s->pb) >> 3; | 1319 | return put_bytes_output(&s->pb); |
| 1320 | } | 1320 | } |
| 1321 | 1321 | ||
| 1322 | 1322 | ||
| @@ -115,7 +115,7 @@ int ff_hevc_encode_nal_vps(HEVCVPS *vps, unsigned int id, · 114 unmodified lines | |||
| 115 | put_bits(&pb, 1, 1); // stop bit | 115 | put_bits(&pb, 1, 1); // stop bit |
| 116 | flush_put_bits(&pb); | 116 | flush_put_bits(&pb); |
| 117 | 117 | ||
| 118 | data_size = put_bits_count(&pb) / 8; | 118 | data_size = put_bytes_output(&pb); |
| 119 | 119 | ||
| 120 | return data_size; | 120 | return data_size; |
| 121 | } | 121 | } |
| @@ -189,7 +189,7 @@ static void clearTable(LZWEncodeState * s) · 188 unmodified lines | |||
| 189 | * @return Number of bytes written | 189 | * @return Number of bytes written |
| 190 | */ | 190 | */ |
| 191 | static int writtenBytes(LZWEncodeState *s){ | 191 | static int writtenBytes(LZWEncodeState *s){ |
| 192 | int ret = put_bits_count(&s->pb) >> 3; | 192 | int ret = put_bytes_count(&s->pb, 0); |
| 193 | ret -= s->output_bytes; | 193 | ret -= s->output_bytes; |
| 194 | s->output_bytes += ret; | 194 | s->output_bytes += ret; |
| 195 | return ret; | 195 | return ret; |
| @@ -400,11 +400,9 @@ static int encode_slice(uint8_t *src, uint8_t *dst, int dst_size, · 399 unmodified lines | |||
| 400 | if (count) | 400 | if (count) |
| 401 | put_bits(&pb, 32 - count, 0); | 401 | put_bits(&pb, 32 - count, 0); |
| 402 | 402 | ||
| 403 | count = put_bits_count(&pb); | ||
| 404 | |||
| 405 | flush_put_bits(&pb); | 403 | flush_put_bits(&pb); |
| 406 | 404 | ||
| 407 | return count >> 3; | 405 | return put_bytes_output(&pb); |
| 408 | } | 406 | } |
| 409 | 407 | ||
| 410 | static int magy_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | 408 | static int magy_encode_frame(AVCodecContext *avctx, AVPacket *pkt, |
| @@ -499,7 +497,7 @@ static int magy_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 88 unmodified lines | |||
| 499 | AV_CEIL_RSHIFT(frame->height, s->vshift[i]), | 497 | AV_CEIL_RSHIFT(frame->height, s->vshift[i]), |
| 500 | &s->pb, s->he[i]); | 498 | &s->pb, s->he[i]); |
| 501 | } | 499 | } |
| 502 | s->tables_size = (put_bits_count(&s->pb) + 7) >> 3; | 500 | s->tables_size = put_bytes_count(&s->pb, 1); |
| 503 | bytestream2_skip_p(&pb, s->tables_size); | 501 | bytestream2_skip_p(&pb, s->tables_size); |
| 504 | 502 | ||
| 505 | for (i = 0; i < s->planes; i++) { | 503 | for (i = 0; i < s->planes; i++) { |
| @@ -218,7 +218,7 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s) · 217 unmodified lines | |||
| 218 | 218 | ||
| 219 | if ((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < s->mb_height - 1) | 219 | if ((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < s->mb_height - 1) |
| 220 | put_marker(pbc, RST0 + (mb_y&7)); | 220 | put_marker(pbc, RST0 + (mb_y&7)); |
| 221 | s->esc_pos = put_bits_count(pbc) >> 3; | 221 | s->esc_pos = put_bytes_count(pbc, 0); |
| 222 | 222 | ||
| 223 | fail: | 223 | fail: |
| 224 | for (int i = 0; i < 3; i++) | 224 | for (int i = 0; i < 3; i++) |
| @@ -325,7 +325,7 @@ end: · 324 unmodified lines | |||
| 325 | MpegEncContext *s = avctx->priv_data; | 325 | MpegEncContext *s = avctx->priv_data; |
| 326 | av_assert0(avctx->codec->priv_data_size == sizeof(MpegEncContext)); | 326 | av_assert0(avctx->codec->priv_data_size == sizeof(MpegEncContext)); |
| 327 | 327 | ||
| 328 | s->esc_pos = put_bits_count(pb) >> 3; | 328 | s->esc_pos = put_bytes_count(pb, 0); |
| 329 | for(i=1; i<s->slice_context_count; i++) | 329 | for(i=1; i<s->slice_context_count; i++) |
| 330 | s->thread_context[i]->esc_pos = 0; | 330 | s->thread_context[i]->esc_pos = 0; |
| 331 | } | 331 | } |
| @@ -343,10 +343,7 @@ void ff_mjpeg_escape_FF(PutBitContext *pb, int start) · 11 unmodified lines | |||
| 343 | put_bits(pb, pad, (1<<pad)-1); | 343 | put_bits(pb, pad, (1<<pad)-1); |
| 344 | 344 | ||
| 345 | flush_put_bits(pb); | 345 | flush_put_bits(pb); |
| 346 | size = put_bits_count(pb) - start * 8; | 346 | size = put_bytes_output(pb) - start; |
| 347 | |||
| 348 | av_assert1((size&7) == 0); | ||
| 349 | size >>= 3; | ||
| 350 | 347 | ||
| 351 | ff_count=0; | 348 | ff_count=0; |
| 352 | for(i=0; i<size && i<align; i++){ | 349 | for(i=0; i<size && i<align; i++){ |
| @@ -1121,18 +1121,18 @@ static uint8_t *write_substrs(MLPEncodeContext *ctx, uint8_t *buf, int buf_size, · 1120 unmodified lines | |||
| 1121 | * notice that we already are word-aligned here. */ | 1121 | * notice that we already are word-aligned here. */ |
| 1122 | flush_put_bits(&pb); | 1122 | flush_put_bits(&pb); |
| 1123 | 1123 | ||
| 1124 | parity = ff_mlp_calculate_parity(buf, put_bits_count(&pb) >> 3) ^ 0xa9; | 1124 | parity = ff_mlp_calculate_parity(buf, put_bytes_output(&pb)) ^ 0xa9; |
| 1125 | checksum = ff_mlp_checksum8 (buf, put_bits_count(&pb) >> 3); | 1125 | checksum = ff_mlp_checksum8 (buf, put_bytes_output(&pb)); |
| 1126 | 1126 | ||
| 1127 | put_bits(&pb, 8, parity ); | 1127 | put_bits(&pb, 8, parity ); |
| 1128 | put_bits(&pb, 8, checksum); | 1128 | put_bits(&pb, 8, checksum); |
| 1129 | 1129 | ||
| 1130 | flush_put_bits(&pb); | 1130 | flush_put_bits(&pb); |
| 1131 | 1131 | ||
| 1132 | end += put_bits_count(&pb) >> 3; | 1132 | end += put_bytes_output(&pb); |
| 1133 | substream_data_len[substr] = end; | 1133 | substream_data_len[substr] = end; |
| 1134 | 1134 | ||
| 1135 | buf += put_bits_count(&pb) >> 3; | 1135 | buf += put_bytes_output(&pb); |
| 1136 | } | 1136 | } |
| 1137 | 1137 | ||
| 1138 | ctx->major_cur_subblock_index += ctx->major_filter_state_subblock + 1; | 1138 | ctx->major_cur_subblock_index += ctx->major_filter_state_subblock + 1; |
| @@ -439,7 +439,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number) · 438 unmodified lines | |||
| 439 | (s->picture_number - s->gop_picture_number) & 0x3ff); | 439 | (s->picture_number - s->gop_picture_number) & 0x3ff); |
| 440 | put_bits(&s->pb, 3, s->pict_type); | 440 | put_bits(&s->pb, 3, s->pict_type); |
| 441 | 441 | ||
| 442 | s->vbv_delay_ptr = s->pb.buf + put_bits_count(&s->pb) / 8; | 442 | s->vbv_delay_ptr = s->pb.buf + put_bytes_count(&s->pb, 0); |
| 443 | put_bits(&s->pb, 16, 0xFFFF); /* vbv_delay */ | 443 | put_bits(&s->pb, 16, 0xFFFF); /* vbv_delay */ |
| 444 | 444 | ||
| 445 | // RAL: Forward f_code also needed for B-frames | 445 | // RAL: Forward f_code also needed for B-frames |
| @@ -1314,7 +1314,7 @@ static av_cold int encode_init(AVCodecContext *avctx) · 1313 unmodified lines | |||
| 1314 | 1314 | ||
| 1315 | // ff_mpeg4_stuffing(&s->pb); ? | 1315 | // ff_mpeg4_stuffing(&s->pb); ? |
| 1316 | flush_put_bits(&s->pb); | 1316 | flush_put_bits(&s->pb); |
| 1317 | s->avctx->extradata_size = (put_bits_count(&s->pb) + 7) >> 3; | 1317 | s->avctx->extradata_size = put_bytes_output(&s->pb); |
| 1318 | } | 1318 | } |
| 1319 | return 0; | 1319 | return 0; |
| 1320 | } | 1320 | } |
| @@ -736,9 +736,6 @@ static void encode_frame(MpegAudioContext *s, · 735 unmodified lines | |||
| 736 | /* padding */ | 736 | /* padding */ |
| 737 | for(i=0;i<padding;i++) | 737 | for(i=0;i<padding;i++) |
| 738 | put_bits(p, 1, 0); | 738 | put_bits(p, 1, 0); |
| 739 | |||
| 740 | /* flush */ | ||
| 741 | flush_put_bits(p); | ||
| 742 | } | 739 | } |
| 743 | 740 | ||
| 744 | static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, | 741 | static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
| @@ -770,10 +767,13 @@ static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 25 unmodified lines | |||
| 770 | 767 | ||
| 771 | encode_frame(s, bit_alloc, padding); | 768 | encode_frame(s, bit_alloc, padding); |
| 772 | 769 | ||
| 770 | /* flush */ | ||
| 771 | flush_put_bits(&s->pb); | ||
| 772 | avpkt->size = put_bytes_output(&s->pb); | ||
| 773 | |||
| 773 | if (frame->pts != AV_NOPTS_VALUE) | 774 | if (frame->pts != AV_NOPTS_VALUE) |
| 774 | avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding); | 775 | avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding); |
| 775 | 776 | ||
| 776 | avpkt->size = put_bits_count(&s->pb) / 8; | ||
| 777 | *got_packet_ptr = 1; | 777 | *got_packet_ptr = 1; |
| 778 | return 0; | 778 | return 0; |
| 779 | } | 779 | } |
| @@ -2889,12 +2889,12 @@ static void update_mb_info(MpegEncContext *s, int startcode) · 2888 unmodified lines | |||
| 2889 | { | 2889 | { |
| 2890 | if (!s->mb_info) | 2890 | if (!s->mb_info) |
| 2891 | return; | 2891 | return; |
| 2892 | if (put_bits_count(&s->pb) - s->prev_mb_info*8 >= s->mb_info*8) { | 2892 | if (put_bytes_count(&s->pb, 0) - s->prev_mb_info >= s->mb_info) { |
| 2893 | s->mb_info_size += 12; | 2893 | s->mb_info_size += 12; |
| 2894 | s->prev_mb_info = s->last_mb_info; | 2894 | s->prev_mb_info = s->last_mb_info; |
| 2895 | } | 2895 | } |
| 2896 | if (startcode) { | 2896 | if (startcode) { |
| 2897 | s->prev_mb_info = put_bits_count(&s->pb)/8; | 2897 | s->prev_mb_info = put_bytes_count(&s->pb, 0); |
| 2898 | /* This might have incremented mb_info_size above, and we return without | 2898 | /* This might have incremented mb_info_size above, and we return without |
| 2899 | * actually writing any info into that slot yet. But in that case, | 2899 | * actually writing any info into that slot yet. But in that case, |
| 2900 | * this will be called again at the start of the after writing the | 2900 | * this will be called again at the start of the after writing the |
| @@ -2902,7 +2902,7 @@ static void update_mb_info(MpegEncContext *s, int startcode) · 1 unmodified line | |||
| 2902 | return; | 2902 | return; |
| 2903 | } | 2903 | } |
| 2904 | 2904 | ||
| 2905 | s->last_mb_info = put_bits_count(&s->pb)/8; | 2905 | s->last_mb_info = put_bytes_count(&s->pb, 0); |
| 2906 | if (!s->mb_info_size) | 2906 | if (!s->mb_info_size) |
| 2907 | s->mb_info_size += 12; | 2907 | s->mb_info_size += 12; |
| 2908 | write_mb_info(s); | 2908 | write_mb_info(s); |
| @@ -3057,7 +3057,8 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 148 unmodified lines | |||
| 3057 | if(s->rtp_mode){ | 3057 | if(s->rtp_mode){ |
| 3058 | int current_packet_size, is_gob_start; | 3058 | int current_packet_size, is_gob_start; |
| 3059 | 3059 | ||
| 3060 | current_packet_size= ((put_bits_count(&s->pb)+7)>>3) - (s->ptr_lastgob - s->pb.buf); | 3060 | current_packet_size = put_bytes_count(&s->pb, 1) |
| 3061 | - (s->ptr_lastgob - s->pb.buf); | ||
| 3061 | 3062 | ||
| 3062 | is_gob_start = s->rtp_payload_size && | 3063 | is_gob_start = s->rtp_payload_size && |
| 3063 | current_packet_size >= s->rtp_payload_size && | 3064 | current_packet_size >= s->rtp_payload_size && |
| @@ -3094,7 +3095,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 30 unmodified lines | |||
| 3094 | current_packet_size= put_bits_ptr(&s->pb) - s->ptr_lastgob; | 3095 | current_packet_size= put_bits_ptr(&s->pb) - s->ptr_lastgob; |
| 3095 | 3096 | ||
| 3096 | if (s->error_rate && s->resync_mb_x + s->resync_mb_y > 0) { | 3097 | if (s->error_rate && s->resync_mb_x + s->resync_mb_y > 0) { |
| 3097 | int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y; | 3098 | int r = put_bytes_count(&s->pb, 0) + s->picture_number + 16 + s->mb_x + s->mb_y; |
| 3098 | int d = 100 / s->error_rate; | 3099 | int d = 100 / s->error_rate; |
| 3099 | if(r % d == 0){ | 3100 | if(r % d == 0){ |
| 3100 | current_packet_size=0; | 3101 | current_packet_size=0; |
| @@ -460,7 +460,7 @@ static av_always_inline int encode_alpha_slice_data(AVCodecContext *avctx, int8_ · 459 unmodified lines | |||
| 460 | if (run) | 460 | if (run) |
| 461 | put_alpha_run(&pb, run); | 461 | put_alpha_run(&pb, run); |
| 462 | flush_put_bits(&pb); | 462 | flush_put_bits(&pb); |
| 463 | *a_data_size = put_bits_count(&pb) >> 3; | 463 | *a_data_size = put_bytes_output(&pb); |
| 464 | 464 | ||
| 465 | if (put_bits_left(&pb) < 0) { | 465 | if (put_bits_left(&pb) < 0) { |
| 466 | av_log(avctx, AV_LOG_ERROR, | 466 | av_log(avctx, AV_LOG_ERROR, |
| @@ -802,7 +802,7 @@ static int rpza_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 801 unmodified lines | |||
| 802 | 802 | ||
| 803 | flush_put_bits(&s->pb); | 803 | flush_put_bits(&s->pb); |
| 804 | 804 | ||
| 805 | av_shrink_packet(pkt, put_bits_count(&s->pb) >> 3); | 805 | av_shrink_packet(pkt, put_bytes_output(&s->pb)); |
| 806 | buf = pkt->data; | 806 | buf = pkt->data; |
| 807 | 807 | ||
| 808 | // write header opcode | 808 | // write header opcode |
| @@ -188,7 +188,7 @@ static size_t sbc_pack_frame(AVPacket *avpkt, struct sbc_frame *frame, · 187 unmodified lines | |||
| 188 | 188 | ||
| 189 | flush_put_bits(&pb); | 189 | flush_put_bits(&pb); |
| 190 | 190 | ||
| 191 | return (put_bits_count(&pb) + 7) / 8; | 191 | return put_bytes_output(&pb); |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | static int sbc_encode_init(AVCodecContext *avctx) | 194 | static int sbc_encode_init(AVCodecContext *avctx) |
| @@ -687,7 +687,7 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx) · 686 unmodified lines | |||
| 687 | put_bits(&pb, 1, 0); // XXX FIXME: no custom tap quant table | 687 | put_bits(&pb, 1, 0); // XXX FIXME: no custom tap quant table |
| 688 | 688 | ||
| 689 | flush_put_bits(&pb); | 689 | flush_put_bits(&pb); |
| 690 | avctx->extradata_size = put_bits_count(&pb)/8; | 690 | avctx->extradata_size = put_bytes_output(&pb); |
| 691 | 691 | ||
| 692 | av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n", | 692 | av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n", |
| 693 | s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling); | 693 | s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling); |
| @@ -652,7 +652,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 651 unmodified lines | |||
| 652 | 652 | ||
| 653 | flush_put_bits(&s->pb); | 653 | flush_put_bits(&s->pb); |
| 654 | 654 | ||
| 655 | pkt->size = put_bits_count(&s->pb) / 8; | 655 | pkt->size = put_bytes_output(&s->pb); |
| 656 | if (s->pict_type == AV_PICTURE_TYPE_I) | 656 | if (s->pict_type == AV_PICTURE_TYPE_I) |
| 657 | pkt->flags |= AV_PKT_FLAG_KEY; | 657 | pkt->flags |= AV_PKT_FLAG_KEY; |
| 658 | *got_packet = 1; | 658 | *got_packet = 1; |
| @@ -120,7 +120,7 @@ static int put_cabac_terminate(CABACTestContext *c, int bit) · 119 unmodified lines | |||
| 120 | flush_put_bits(&c->pb); //FIXME FIXME FIXME XXX wrong | 120 | flush_put_bits(&c->pb); //FIXME FIXME FIXME XXX wrong |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | return (put_bits_count(&c->pb)+7)>>3; | 123 | return put_bytes_count(&c->pb, 1); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | /** | 126 | /** |
| @@ -182,7 +182,7 @@ pkt_alloc: · 181 unmodified lines | |||
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | flush_put_bits(&pb); | 184 | flush_put_bits(&pb); |
| 185 | out_bytes = put_bits_count(&pb) >> 3; | 185 | out_bytes = put_bytes_output(&pb); |
| 186 | put_bits32(&pb, av_crc(s->crc_table, UINT32_MAX, avpkt->data, out_bytes) ^ UINT32_MAX); | 186 | put_bits32(&pb, av_crc(s->crc_table, UINT32_MAX, avpkt->data, out_bytes) ^ UINT32_MAX); |
| 187 | flush_put_bits(&pb); | 187 | flush_put_bits(&pb); |
| 188 | 188 | ||
| @@ -637,7 +637,7 @@ static int put_main_header(vorbis_enc_context *venc, uint8_t **out) · 636 unmodified lines | |||
| 637 | put_bits(&pb, 1, 1); // framing | 637 | put_bits(&pb, 1, 1); // framing |
| 638 | 638 | ||
| 639 | flush_put_bits(&pb); | 639 | flush_put_bits(&pb); |
| 640 | hlens[0] = put_bits_count(&pb) >> 3; | 640 | hlens[0] = put_bytes_output(&pb); |
| 641 | buffer_len -= hlens[0]; | 641 | buffer_len -= hlens[0]; |
| 642 | p += hlens[0]; | 642 | p += hlens[0]; |
| 643 | 643 | ||
| @@ -651,7 +651,7 @@ static int put_main_header(vorbis_enc_context *venc, uint8_t **out) · 7 unmodified lines | |||
| 651 | put_bits(&pb, 1, 1); // framing | 651 | put_bits(&pb, 1, 1); // framing |
| 652 | 652 | ||
| 653 | flush_put_bits(&pb); | 653 | flush_put_bits(&pb); |
| 654 | hlens[1] = put_bits_count(&pb) >> 3; | 654 | hlens[1] = put_bytes_output(&pb); |
| 655 | buffer_len -= hlens[1]; | 655 | buffer_len -= hlens[1]; |
| 656 | p += hlens[1]; | 656 | p += hlens[1]; |
| 657 | 657 | ||
| @@ -725,7 +725,7 @@ static int put_main_header(vorbis_enc_context *venc, uint8_t **out) · 67 unmodified lines | |||
| 725 | put_bits(&pb, 1, 1); // framing | 725 | put_bits(&pb, 1, 1); // framing |
| 726 | 726 | ||
| 727 | flush_put_bits(&pb); | 727 | flush_put_bits(&pb); |
| 728 | hlens[2] = put_bits_count(&pb) >> 3; | 728 | hlens[2] = put_bytes_output(&pb); |
| 729 | 729 | ||
| 730 | len = hlens[0] + hlens[1] + hlens[2]; | 730 | len = hlens[0] + hlens[1] + hlens[2]; |
| 731 | p = *out = av_mallocz(64 + len + len/255); | 731 | p = *out = av_mallocz(64 + len + len/255); |
| @@ -1180,7 +1180,7 @@ static int vorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 448 unmodified lines | |||
| 1180 | } | 1180 | } |
| 1181 | 1181 | ||
| 1182 | flush_put_bits(&pb); | 1182 | flush_put_bits(&pb); |
| 1183 | avpkt->size = put_bits_count(&pb) >> 3; | 1183 | avpkt->size = put_bytes_output(&pb); |
| 1184 | 1184 | ||
| 1185 | ff_af_queue_remove(&venc->afq, frame_size, &avpkt->pts, &avpkt->duration); | 1185 | ff_af_queue_remove(&venc->afq, frame_size, &avpkt->pts, &avpkt->duration); |
| 1186 | 1186 | ||
| @@ -2777,7 +2777,7 @@ static int wavpack_encode_block(WavPackEncodeContext *s, · 2776 unmodified lines | |||
| 2777 | } | 2777 | } |
| 2778 | encode_flush(s); | 2778 | encode_flush(s); |
| 2779 | flush_put_bits(&s->pb); | 2779 | flush_put_bits(&s->pb); |
| 2780 | data_size = put_bits_count(&s->pb) >> 3; | 2780 | data_size = put_bytes_output(&s->pb); |
| 2781 | bytestream2_put_le24(&pb, (data_size + 1) >> 1); | 2781 | bytestream2_put_le24(&pb, (data_size + 1) >> 1); |
| 2782 | bytestream2_skip_p(&pb, data_size); | 2782 | bytestream2_skip_p(&pb, data_size); |
| 2783 | if (data_size & 1) | 2783 | if (data_size & 1) |
| @@ -2791,7 +2791,7 @@ static int wavpack_encode_block(WavPackEncodeContext *s, · 7 unmodified lines | |||
| 2791 | else | 2791 | else |
| 2792 | pack_int32(s, s->orig_l, s->orig_r, nb_samples); | 2792 | pack_int32(s, s->orig_l, s->orig_r, nb_samples); |
| 2793 | flush_put_bits(&s->pb); | 2793 | flush_put_bits(&s->pb); |
| 2794 | data_size = put_bits_count(&s->pb) >> 3; | 2794 | data_size = put_bytes_output(&s->pb); |
| 2795 | bytestream2_put_le24(&pb, (data_size + 5) >> 1); | 2795 | bytestream2_put_le24(&pb, (data_size + 5) >> 1); |
| 2796 | bytestream2_put_le32(&pb, s->crc_x); | 2796 | bytestream2_put_le32(&pb, s->crc_x); |
| 2797 | bytestream2_skip_p(&pb, data_size); | 2797 | bytestream2_skip_p(&pb, data_size); |
| @@ -408,7 +408,7 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt, · 407 unmodified lines | |||
| 408 | return AVERROR(EINVAL); | 408 | return AVERROR(EINVAL); |
| 409 | } | 409 | } |
| 410 | av_assert0((put_bits_count(&s->pb) & 7) == 0); | 410 | av_assert0((put_bits_count(&s->pb) & 7) == 0); |
| 411 | i= avctx->block_align - (put_bits_count(&s->pb)+7)/8; | 411 | i = avctx->block_align - put_bytes_count(&s->pb, 0); |
| 412 | av_assert0(i>=0); | 412 | av_assert0(i>=0); |
| 413 | while(i--) | 413 | while(i--) |
| 414 | put_bits(&s->pb, 8, 'N'); | 414 | put_bits(&s->pb, 8, 'N'); |
| @@ -197,7 +197,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 196 unmodified lines | |||
| 197 | h->rects[0]->linesize[0] * 2, | 197 | h->rects[0]->linesize[0] * 2, |
| 198 | h->rects[0]->w, (h->rects[0]->h + 1) >> 1)) | 198 | h->rects[0]->w, (h->rects[0]->h + 1) >> 1)) |
| 199 | return AVERROR_BUFFER_TOO_SMALL; | 199 | return AVERROR_BUFFER_TOO_SMALL; |
| 200 | bytestream_put_le16(&rlelenptr, put_bits_count(&pb) >> 3); // Length of first field | 200 | bytestream_put_le16(&rlelenptr, put_bytes_count(&pb, 0)); // Length of first field |
| 201 | 201 | ||
| 202 | if (xsub_encode_rle(&pb, h->rects[0]->data[0] + h->rects[0]->linesize[0], | 202 | if (xsub_encode_rle(&pb, h->rects[0]->data[0] + h->rects[0]->linesize[0], |
| 203 | h->rects[0]->linesize[0] * 2, | 203 | h->rects[0]->linesize[0] * 2, |
| @@ -211,7 +211,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 7 unmodified lines | |||
| 211 | 211 | ||
| 212 | flush_put_bits(&pb); | 212 | flush_put_bits(&pb); |
| 213 | 213 | ||
| 214 | return hdr - buf + put_bits_count(&pb)/8; | 214 | return hdr - buf + put_bytes_output(&pb); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | static av_cold int xsub_encoder_init(AVCodecContext *avctx) | 217 | static av_cold int xsub_encoder_init(AVCodecContext *avctx) |
| @@ -561,7 +561,7 @@ static int binary_export(AVFilterContext *ctx, StreamContext *sc, const char* fi · 560 unmodified lines | |||
| 561 | } | 561 | } |
| 562 | 562 | ||
| 563 | flush_put_bits(&buf); | 563 | flush_put_bits(&buf); |
| 564 | fwrite(buffer, 1, put_bits_count(&buf)/8, f); | 564 | fwrite(buffer, 1, put_bytes_output(&buf), f); |
| 565 | fclose(f); | 565 | fclose(f); |
| 566 | av_freep(&buffer); | 566 | av_freep(&buffer); |
| 567 | return 0; | 567 | return 0; |
| @@ -225,7 +225,7 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt) · 224 unmodified lines | |||
| 225 | 225 | ||
| 226 | flush_put_bits(&bs); | 226 | flush_put_bits(&bs); |
| 227 | 227 | ||
| 228 | len = put_bits_count(&bs) >> 3; | 228 | len = put_bytes_output(&bs); |
| 229 | 229 | ||
| 230 | if (len > 0x1fff) | 230 | if (len > 0x1fff) |
| 231 | goto too_large; | 231 | goto too_large; |
| @@ -579,7 +579,7 @@ static int mov_write_eac3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra · 578 unmodified lines | |||
| 579 | } | 579 | } |
| 580 | } | 580 | } |
| 581 | flush_put_bits(&pbc); | 581 | flush_put_bits(&pbc); |
| 582 | size = put_bits_count(&pbc) >> 3; | 582 | size = put_bytes_output(&pbc); |
| 583 | 583 | ||
| 584 | avio_wb32(pb, size + 8); | 584 | avio_wb32(pb, size + 8); |
| 585 | ffio_wfourcc(pb, "dec3"); | 585 | ffio_wfourcc(pb, "dec3"); |