Browse Source

Avoid intermediate bitcount for number of bytes in PutBitContext

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
master
Andreas Rheinhardt Andreas Rheinhardt 4 years ago
parent
commit
c81b8e04aa
34 changed files with 55 additions and 59 deletions
  1. +2
    -2
      libavcodec/aacenc.c
  2. +1
    -1
      libavcodec/alacenc.c
  3. +1
    -1
      libavcodec/asvenc.c
  4. +1
    -1
      libavcodec/cbs.c
  5. +1
    -1
      libavcodec/cfhdenc.c
  6. +1
    -1
      libavcodec/cljrenc.c
  7. +1
    -1
      libavcodec/dca.c
  8. +1
    -1
      libavcodec/dcaenc.c
  9. +1
    -1
      libavcodec/ffv1enc.c
  10. +3
    -3
      libavcodec/flacenc.c
  11. +1
    -1
      libavcodec/hevc_ps_enc.c
  12. +1
    -1
      libavcodec/lzwenc.c
  13. +2
    -4
      libavcodec/magicyuvenc.c
  14. +1
    -1
      libavcodec/mjpegenc.c
  15. +2
    -5
      libavcodec/mjpegenc_common.c
  16. +4
    -4
      libavcodec/mlpenc.c
  17. +1
    -1
      libavcodec/mpeg12enc.c
  18. +1
    -1
      libavcodec/mpeg4videoenc.c
  19. +4
    -4
      libavcodec/mpegaudioenc_template.c
  20. +6
    -5
      libavcodec/mpegvideo_enc.c
  21. +1
    -1
      libavcodec/proresenc_anatoliy.c
  22. +1
    -1
      libavcodec/rpzaenc.c
  23. +1
    -1
      libavcodec/sbcenc.c
  24. +1
    -1
      libavcodec/sonic.c
  25. +1
    -1
      libavcodec/svq1enc.c
  26. +1
    -1
      libavcodec/tests/cabac.c
  27. +1
    -1
      libavcodec/ttaenc.c
  28. +4
    -4
      libavcodec/vorbisenc.c
  29. +2
    -2
      libavcodec/wavpackenc.c
  30. +1
    -1
      libavcodec/wmaenc.c
  31. +2
    -2
      libavcodec/xsubenc.c
  32. +1
    -1
      libavfilter/vf_signature.c
  33. +1
    -1
      libavformat/latmenc.c
  34. +1
    -1
      libavformat/movenc.c

+ 2
- 2
libavcodec/aacenc.c View File

@@ -115,7 +115,7 @@ static int put_audio_specific_config(AVCodecContext *avctx)
put_bits(&pb, 5, AOT_SBR); put_bits(&pb, 5, AOT_SBR);
put_bits(&pb, 1, 0); put_bits(&pb, 1, 0);
flush_put_bits(&pb); flush_put_bits(&pb);
avctx->extradata_size = put_bits_count(&pb) >> 3;
avctx->extradata_size = put_bytes_output(&pb);


return 0; return 0;
} }
@@ -881,6 +881,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
flush_put_bits(&s->pb); flush_put_bits(&s->pb);


s->last_frame_pb_count = put_bits_count(&s->pb); s->last_frame_pb_count = put_bits_count(&s->pb);
avpkt->size = put_bytes_output(&s->pb);


s->lambda_sum += s->lambda; s->lambda_sum += s->lambda;
s->lambda_count++; s->lambda_count++;
@@ -888,7 +889,6 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts, ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
&avpkt->duration); &avpkt->duration);


avpkt->size = put_bits_count(&s->pb) >> 3;
*got_packet_ptr = 1; *got_packet_ptr = 1;
return 0; return 0;
} }


+ 1
- 1
libavcodec/alacenc.c View File

@@ -485,7 +485,7 @@ static int write_frame(AlacEncodeContext *s, AVPacket *avpkt,
put_bits(pb, 3, TYPE_END); put_bits(pb, 3, TYPE_END);
flush_put_bits(pb); flush_put_bits(pb);


return put_bits_count(pb) >> 3;
return put_bytes_output(pb);
} }


static av_always_inline int get_max_frame_size(int frame_size, int ch, int bps) static av_always_inline int get_max_frame_size(int frame_size, int ch, int bps)


+ 1
- 1
libavcodec/asvenc.c View File

@@ -290,7 +290,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
else else
flush_put_bits_le(&a->pb); flush_put_bits_le(&a->pb);
AV_WN32(put_bits_ptr(&a->pb), 0); AV_WN32(put_bits_ptr(&a->pb), 0);
size = (put_bits_count(&a->pb) + 31) / 32;
size = (put_bytes_output(&a->pb) + 3) / 4;


if (avctx->codec_id == AV_CODEC_ID_ASV1) { if (avctx->codec_id == AV_CODEC_ID_ASV1) {
a->bbdsp.bswap_buf((uint32_t *) pkt->data, a->bbdsp.bswap_buf((uint32_t *) pkt->data,


+ 1
- 1
libavcodec/cbs.c View File

@@ -346,7 +346,7 @@ static int cbs_write_unit_data(CodedBitstreamContext *ctx,


flush_put_bits(&pbc); flush_put_bits(&pbc);


ret = ff_cbs_alloc_unit_data(unit, put_bits_count(&pbc) / 8);
ret = ff_cbs_alloc_unit_data(unit, put_bytes_output(&pbc));
if (ret < 0) if (ret < 0)
return ret; return ret;




+ 1
- 1
libavcodec/cfhdenc.c View File

@@ -766,7 +766,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
put_bits(pb, cb[512].size, cb[512].bits); put_bits(pb, cb[512].size, cb[512].bits);


flush_put_bits(pb); flush_put_bits(pb);
bytestream2_skip_p(pby, put_bits_count(pb) >> 3);
bytestream2_skip_p(pby, put_bytes_output(pb));
padd = (4 - (bytestream2_tell_p(pby) & 3)) & 3; padd = (4 - (bytestream2_tell_p(pby) & 3)) & 3;
while (padd--) while (padd--)
bytestream2_put_byte(pby, 0); bytestream2_put_byte(pby, 0);


+ 1
- 1
libavcodec/cljrenc.c View File

@@ -89,7 +89,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,


flush_put_bits(&pb); flush_put_bits(&pb);


pkt->size = put_bits_count(&pb) / 8;
pkt->size = put_bytes_output(&pb);
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1; *got_packet = 1;
return 0; return 0;


+ 1
- 1
libavcodec/dca.c View File

@@ -82,7 +82,7 @@ int avpriv_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst,
put_bits(&pb, 14, tmp); put_bits(&pb, 14, tmp);
} }
flush_put_bits(&pb); flush_put_bits(&pb);
return (put_bits_count(&pb) + 7) >> 3;
return put_bytes_output(&pb);
default: default:
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }


+ 1
- 1
libavcodec/dcaenc.c View File

@@ -1213,8 +1213,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
flush_put_bits(&c->pb); flush_put_bits(&c->pb);


avpkt->pts = frame->pts; avpkt->pts = frame->pts;
avpkt->size = put_bytes_output(&c->pb);
avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
avpkt->size = put_bits_count(&c->pb) >> 3;
*got_packet_ptr = 1; *got_packet_ptr = 1;
return 0; return 0;
} }


+ 1
- 1
libavcodec/ffv1enc.c View File

@@ -1239,7 +1239,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
bytes = ff_rac_terminate(&fs->c, 1); bytes = ff_rac_terminate(&fs->c, 1);
} else { } else {
flush_put_bits(&fs->pb); // FIXME: nicer padding flush_put_bits(&fs->pb); // FIXME: nicer padding
bytes = fs->ac_byte_count + (put_bits_count(&fs->pb) + 7) / 8;
bytes = fs->ac_byte_count + put_bytes_output(&fs->pb);
} }
if (i > 0 || f->version > 2) { if (i > 0 || f->version > 2) {
av_assert0(bytes < pkt->size / f->slice_count); av_assert0(bytes < pkt->size / f->slice_count);


+ 3
- 3
libavcodec/flacenc.c View File

@@ -1234,7 +1234,7 @@ static void write_frame_header(FlacEncodeContext *s)


flush_put_bits(&s->pb); flush_put_bits(&s->pb);
crc = av_crc(av_crc_get_table(AV_CRC_8_ATM), 0, s->pb.buf, crc = av_crc(av_crc_get_table(AV_CRC_8_ATM), 0, s->pb.buf,
put_bits_count(&s->pb) >> 3);
put_bytes_output(&s->pb));
put_bits(&s->pb, 8, crc); put_bits(&s->pb, 8, crc);
} }


@@ -1304,7 +1304,7 @@ static void write_frame_footer(FlacEncodeContext *s)
int crc; int crc;
flush_put_bits(&s->pb); flush_put_bits(&s->pb);
crc = av_bswap16(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, s->pb.buf, crc = av_bswap16(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, s->pb.buf,
put_bits_count(&s->pb)>>3));
put_bytes_output(&s->pb)));
put_bits(&s->pb, 16, crc); put_bits(&s->pb, 16, crc);
flush_put_bits(&s->pb); flush_put_bits(&s->pb);
} }
@@ -1316,7 +1316,7 @@ static int write_frame(FlacEncodeContext *s, AVPacket *avpkt)
write_frame_header(s); write_frame_header(s);
write_subframes(s); write_subframes(s);
write_frame_footer(s); write_frame_footer(s);
return put_bits_count(&s->pb) >> 3;
return put_bytes_output(&s->pb);
} }






+ 1
- 1
libavcodec/hevc_ps_enc.c View File

@@ -115,7 +115,7 @@ int ff_hevc_encode_nal_vps(HEVCVPS *vps, unsigned int id,
put_bits(&pb, 1, 1); // stop bit put_bits(&pb, 1, 1); // stop bit
flush_put_bits(&pb); flush_put_bits(&pb);


data_size = put_bits_count(&pb) / 8;
data_size = put_bytes_output(&pb);


return data_size; return data_size;
} }

+ 1
- 1
libavcodec/lzwenc.c View File

@@ -189,7 +189,7 @@ static void clearTable(LZWEncodeState * s)
* @return Number of bytes written * @return Number of bytes written
*/ */
static int writtenBytes(LZWEncodeState *s){ static int writtenBytes(LZWEncodeState *s){
int ret = put_bits_count(&s->pb) >> 3;
int ret = put_bytes_count(&s->pb, 0);
ret -= s->output_bytes; ret -= s->output_bytes;
s->output_bytes += ret; s->output_bytes += ret;
return ret; return ret;


+ 2
- 4
libavcodec/magicyuvenc.c View File

@@ -400,11 +400,9 @@ static int encode_slice(uint8_t *src, uint8_t *dst, int dst_size,
if (count) if (count)
put_bits(&pb, 32 - count, 0); put_bits(&pb, 32 - count, 0);


count = put_bits_count(&pb);

flush_put_bits(&pb); flush_put_bits(&pb);


return count >> 3;
return put_bytes_output(&pb);
} }


static int magy_encode_frame(AVCodecContext *avctx, AVPacket *pkt, static int magy_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
@@ -499,7 +497,7 @@ static int magy_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
AV_CEIL_RSHIFT(frame->height, s->vshift[i]), AV_CEIL_RSHIFT(frame->height, s->vshift[i]),
&s->pb, s->he[i]); &s->pb, s->he[i]);
} }
s->tables_size = (put_bits_count(&s->pb) + 7) >> 3;
s->tables_size = put_bytes_count(&s->pb, 1);
bytestream2_skip_p(&pb, s->tables_size); bytestream2_skip_p(&pb, s->tables_size);


for (i = 0; i < s->planes; i++) { for (i = 0; i < s->planes; i++) {


+ 1
- 1
libavcodec/mjpegenc.c View File

@@ -218,7 +218,7 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s)


if ((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < s->mb_height - 1) if ((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < s->mb_height - 1)
put_marker(pbc, RST0 + (mb_y&7)); put_marker(pbc, RST0 + (mb_y&7));
s->esc_pos = put_bits_count(pbc) >> 3;
s->esc_pos = put_bytes_count(pbc, 0);


fail: fail:
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)


+ 2
- 5
libavcodec/mjpegenc_common.c View File

@@ -325,7 +325,7 @@ end:
MpegEncContext *s = avctx->priv_data; MpegEncContext *s = avctx->priv_data;
av_assert0(avctx->codec->priv_data_size == sizeof(MpegEncContext)); av_assert0(avctx->codec->priv_data_size == sizeof(MpegEncContext));


s->esc_pos = put_bits_count(pb) >> 3;
s->esc_pos = put_bytes_count(pb, 0);
for(i=1; i<s->slice_context_count; i++) for(i=1; i<s->slice_context_count; i++)
s->thread_context[i]->esc_pos = 0; s->thread_context[i]->esc_pos = 0;
} }
@@ -343,10 +343,7 @@ void ff_mjpeg_escape_FF(PutBitContext *pb, int start)
put_bits(pb, pad, (1<<pad)-1); put_bits(pb, pad, (1<<pad)-1);


flush_put_bits(pb); flush_put_bits(pb);
size = put_bits_count(pb) - start * 8;

av_assert1((size&7) == 0);
size >>= 3;
size = put_bytes_output(pb) - start;


ff_count=0; ff_count=0;
for(i=0; i<size && i<align; i++){ for(i=0; i<size && i<align; i++){


+ 4
- 4
libavcodec/mlpenc.c View File

@@ -1121,18 +1121,18 @@ static uint8_t *write_substrs(MLPEncodeContext *ctx, uint8_t *buf, int buf_size,
* notice that we already are word-aligned here. */ * notice that we already are word-aligned here. */
flush_put_bits(&pb); flush_put_bits(&pb);


parity = ff_mlp_calculate_parity(buf, put_bits_count(&pb) >> 3) ^ 0xa9;
checksum = ff_mlp_checksum8 (buf, put_bits_count(&pb) >> 3);
parity = ff_mlp_calculate_parity(buf, put_bytes_output(&pb)) ^ 0xa9;
checksum = ff_mlp_checksum8 (buf, put_bytes_output(&pb));


put_bits(&pb, 8, parity ); put_bits(&pb, 8, parity );
put_bits(&pb, 8, checksum); put_bits(&pb, 8, checksum);


flush_put_bits(&pb); flush_put_bits(&pb);


end += put_bits_count(&pb) >> 3;
end += put_bytes_output(&pb);
substream_data_len[substr] = end; substream_data_len[substr] = end;


buf += put_bits_count(&pb) >> 3;
buf += put_bytes_output(&pb);
} }


ctx->major_cur_subblock_index += ctx->major_filter_state_subblock + 1; ctx->major_cur_subblock_index += ctx->major_filter_state_subblock + 1;


+ 1
- 1
libavcodec/mpeg12enc.c View File

@@ -439,7 +439,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
(s->picture_number - s->gop_picture_number) & 0x3ff); (s->picture_number - s->gop_picture_number) & 0x3ff);
put_bits(&s->pb, 3, s->pict_type); put_bits(&s->pb, 3, s->pict_type);


s->vbv_delay_ptr = s->pb.buf + put_bits_count(&s->pb) / 8;
s->vbv_delay_ptr = s->pb.buf + put_bytes_count(&s->pb, 0);
put_bits(&s->pb, 16, 0xFFFF); /* vbv_delay */ put_bits(&s->pb, 16, 0xFFFF); /* vbv_delay */


// RAL: Forward f_code also needed for B-frames // RAL: Forward f_code also needed for B-frames


+ 1
- 1
libavcodec/mpeg4videoenc.c View File

@@ -1314,7 +1314,7 @@ static av_cold int encode_init(AVCodecContext *avctx)


// ff_mpeg4_stuffing(&s->pb); ? // ff_mpeg4_stuffing(&s->pb); ?
flush_put_bits(&s->pb); flush_put_bits(&s->pb);
s->avctx->extradata_size = (put_bits_count(&s->pb) + 7) >> 3;
s->avctx->extradata_size = put_bytes_output(&s->pb);
} }
return 0; return 0;
} }


+ 4
- 4
libavcodec/mpegaudioenc_template.c View File

@@ -736,9 +736,6 @@ static void encode_frame(MpegAudioContext *s,
/* padding */ /* padding */
for(i=0;i<padding;i++) for(i=0;i<padding;i++)
put_bits(p, 1, 0); put_bits(p, 1, 0);

/* flush */
flush_put_bits(p);
} }


static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
@@ -770,10 +767,13 @@ static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,


encode_frame(s, bit_alloc, padding); encode_frame(s, bit_alloc, padding);


/* flush */
flush_put_bits(&s->pb);
avpkt->size = put_bytes_output(&s->pb);

if (frame->pts != AV_NOPTS_VALUE) if (frame->pts != AV_NOPTS_VALUE)
avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding); avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding);


avpkt->size = put_bits_count(&s->pb) / 8;
*got_packet_ptr = 1; *got_packet_ptr = 1;
return 0; return 0;
} }


+ 6
- 5
libavcodec/mpegvideo_enc.c View File

@@ -2889,12 +2889,12 @@ static void update_mb_info(MpegEncContext *s, int startcode)
{ {
if (!s->mb_info) if (!s->mb_info)
return; return;
if (put_bits_count(&s->pb) - s->prev_mb_info*8 >= s->mb_info*8) {
if (put_bytes_count(&s->pb, 0) - s->prev_mb_info >= s->mb_info) {
s->mb_info_size += 12; s->mb_info_size += 12;
s->prev_mb_info = s->last_mb_info; s->prev_mb_info = s->last_mb_info;
} }
if (startcode) { if (startcode) {
s->prev_mb_info = put_bits_count(&s->pb)/8;
s->prev_mb_info = put_bytes_count(&s->pb, 0);
/* This might have incremented mb_info_size above, and we return without /* This might have incremented mb_info_size above, and we return without
* actually writing any info into that slot yet. But in that case, * actually writing any info into that slot yet. But in that case,
* this will be called again at the start of the after writing the * 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)
return; return;
} }


s->last_mb_info = put_bits_count(&s->pb)/8;
s->last_mb_info = put_bytes_count(&s->pb, 0);
if (!s->mb_info_size) if (!s->mb_info_size)
s->mb_info_size += 12; s->mb_info_size += 12;
write_mb_info(s); write_mb_info(s);
@@ -3057,7 +3057,8 @@ static int encode_thread(AVCodecContext *c, void *arg){
if(s->rtp_mode){ if(s->rtp_mode){
int current_packet_size, is_gob_start; int current_packet_size, is_gob_start;


current_packet_size= ((put_bits_count(&s->pb)+7)>>3) - (s->ptr_lastgob - s->pb.buf);
current_packet_size = put_bytes_count(&s->pb, 1)
- (s->ptr_lastgob - s->pb.buf);


is_gob_start = s->rtp_payload_size && is_gob_start = s->rtp_payload_size &&
current_packet_size >= s->rtp_payload_size && current_packet_size >= s->rtp_payload_size &&
@@ -3094,7 +3095,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
current_packet_size= put_bits_ptr(&s->pb) - s->ptr_lastgob; current_packet_size= put_bits_ptr(&s->pb) - s->ptr_lastgob;


if (s->error_rate && s->resync_mb_x + s->resync_mb_y > 0) { if (s->error_rate && s->resync_mb_x + s->resync_mb_y > 0) {
int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y;
int r = put_bytes_count(&s->pb, 0) + s->picture_number + 16 + s->mb_x + s->mb_y;
int d = 100 / s->error_rate; int d = 100 / s->error_rate;
if(r % d == 0){ if(r % d == 0){
current_packet_size=0; current_packet_size=0;


+ 1
- 1
libavcodec/proresenc_anatoliy.c View File

@@ -460,7 +460,7 @@ static av_always_inline int encode_alpha_slice_data(AVCodecContext *avctx, int8_
if (run) if (run)
put_alpha_run(&pb, run); put_alpha_run(&pb, run);
flush_put_bits(&pb); flush_put_bits(&pb);
*a_data_size = put_bits_count(&pb) >> 3;
*a_data_size = put_bytes_output(&pb);


if (put_bits_left(&pb) < 0) { if (put_bits_left(&pb) < 0) {
av_log(avctx, AV_LOG_ERROR, av_log(avctx, AV_LOG_ERROR,


+ 1
- 1
libavcodec/rpzaenc.c View File

@@ -802,7 +802,7 @@ static int rpza_encode_frame(AVCodecContext *avctx, AVPacket *pkt,


flush_put_bits(&s->pb); flush_put_bits(&s->pb);


av_shrink_packet(pkt, put_bits_count(&s->pb) >> 3);
av_shrink_packet(pkt, put_bytes_output(&s->pb));
buf = pkt->data; buf = pkt->data;


// write header opcode // write header opcode


+ 1
- 1
libavcodec/sbcenc.c View File

@@ -188,7 +188,7 @@ static size_t sbc_pack_frame(AVPacket *avpkt, struct sbc_frame *frame,


flush_put_bits(&pb); flush_put_bits(&pb);


return (put_bits_count(&pb) + 7) / 8;
return put_bytes_output(&pb);
} }


static int sbc_encode_init(AVCodecContext *avctx) static int sbc_encode_init(AVCodecContext *avctx)


+ 1
- 1
libavcodec/sonic.c View File

@@ -687,7 +687,7 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx)
put_bits(&pb, 1, 0); // XXX FIXME: no custom tap quant table put_bits(&pb, 1, 0); // XXX FIXME: no custom tap quant table


flush_put_bits(&pb); flush_put_bits(&pb);
avctx->extradata_size = put_bits_count(&pb)/8;
avctx->extradata_size = put_bytes_output(&pb);


av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n", av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling); s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);


+ 1
- 1
libavcodec/svq1enc.c View File

@@ -652,7 +652,7 @@ FF_ENABLE_DEPRECATION_WARNINGS


flush_put_bits(&s->pb); flush_put_bits(&s->pb);


pkt->size = put_bits_count(&s->pb) / 8;
pkt->size = put_bytes_output(&s->pb);
if (s->pict_type == AV_PICTURE_TYPE_I) if (s->pict_type == AV_PICTURE_TYPE_I)
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1; *got_packet = 1;


+ 1
- 1
libavcodec/tests/cabac.c View File

@@ -120,7 +120,7 @@ static int put_cabac_terminate(CABACTestContext *c, int bit)
flush_put_bits(&c->pb); //FIXME FIXME FIXME XXX wrong flush_put_bits(&c->pb); //FIXME FIXME FIXME XXX wrong
} }


return (put_bits_count(&c->pb)+7)>>3;
return put_bytes_count(&c->pb, 1);
} }


/** /**


+ 1
- 1
libavcodec/ttaenc.c View File

@@ -182,7 +182,7 @@ pkt_alloc:
} }


flush_put_bits(&pb); flush_put_bits(&pb);
out_bytes = put_bits_count(&pb) >> 3;
out_bytes = put_bytes_output(&pb);
put_bits32(&pb, av_crc(s->crc_table, UINT32_MAX, avpkt->data, out_bytes) ^ UINT32_MAX); put_bits32(&pb, av_crc(s->crc_table, UINT32_MAX, avpkt->data, out_bytes) ^ UINT32_MAX);
flush_put_bits(&pb); flush_put_bits(&pb);




+ 4
- 4
libavcodec/vorbisenc.c View File

@@ -637,7 +637,7 @@ static int put_main_header(vorbis_enc_context *venc, uint8_t **out)
put_bits(&pb, 1, 1); // framing put_bits(&pb, 1, 1); // framing


flush_put_bits(&pb); flush_put_bits(&pb);
hlens[0] = put_bits_count(&pb) >> 3;
hlens[0] = put_bytes_output(&pb);
buffer_len -= hlens[0]; buffer_len -= hlens[0];
p += hlens[0]; p += hlens[0];


@@ -651,7 +651,7 @@ static int put_main_header(vorbis_enc_context *venc, uint8_t **out)
put_bits(&pb, 1, 1); // framing put_bits(&pb, 1, 1); // framing


flush_put_bits(&pb); flush_put_bits(&pb);
hlens[1] = put_bits_count(&pb) >> 3;
hlens[1] = put_bytes_output(&pb);
buffer_len -= hlens[1]; buffer_len -= hlens[1];
p += hlens[1]; p += hlens[1];


@@ -725,7 +725,7 @@ static int put_main_header(vorbis_enc_context *venc, uint8_t **out)
put_bits(&pb, 1, 1); // framing put_bits(&pb, 1, 1); // framing


flush_put_bits(&pb); flush_put_bits(&pb);
hlens[2] = put_bits_count(&pb) >> 3;
hlens[2] = put_bytes_output(&pb);


len = hlens[0] + hlens[1] + hlens[2]; len = hlens[0] + hlens[1] + hlens[2];
p = *out = av_mallocz(64 + len + len/255); p = *out = av_mallocz(64 + len + len/255);
@@ -1180,7 +1180,7 @@ static int vorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
} }


flush_put_bits(&pb); flush_put_bits(&pb);
avpkt->size = put_bits_count(&pb) >> 3;
avpkt->size = put_bytes_output(&pb);


ff_af_queue_remove(&venc->afq, frame_size, &avpkt->pts, &avpkt->duration); ff_af_queue_remove(&venc->afq, frame_size, &avpkt->pts, &avpkt->duration);




+ 2
- 2
libavcodec/wavpackenc.c View File

@@ -2777,7 +2777,7 @@ static int wavpack_encode_block(WavPackEncodeContext *s,
} }
encode_flush(s); encode_flush(s);
flush_put_bits(&s->pb); flush_put_bits(&s->pb);
data_size = put_bits_count(&s->pb) >> 3;
data_size = put_bytes_output(&s->pb);
bytestream2_put_le24(&pb, (data_size + 1) >> 1); bytestream2_put_le24(&pb, (data_size + 1) >> 1);
bytestream2_skip_p(&pb, data_size); bytestream2_skip_p(&pb, data_size);
if (data_size & 1) if (data_size & 1)
@@ -2791,7 +2791,7 @@ static int wavpack_encode_block(WavPackEncodeContext *s,
else else
pack_int32(s, s->orig_l, s->orig_r, nb_samples); pack_int32(s, s->orig_l, s->orig_r, nb_samples);
flush_put_bits(&s->pb); flush_put_bits(&s->pb);
data_size = put_bits_count(&s->pb) >> 3;
data_size = put_bytes_output(&s->pb);
bytestream2_put_le24(&pb, (data_size + 5) >> 1); bytestream2_put_le24(&pb, (data_size + 5) >> 1);
bytestream2_put_le32(&pb, s->crc_x); bytestream2_put_le32(&pb, s->crc_x);
bytestream2_skip_p(&pb, data_size); bytestream2_skip_p(&pb, data_size);


+ 1
- 1
libavcodec/wmaenc.c View File

@@ -408,7 +408,7 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
av_assert0((put_bits_count(&s->pb) & 7) == 0); av_assert0((put_bits_count(&s->pb) & 7) == 0);
i= avctx->block_align - (put_bits_count(&s->pb)+7)/8;
i = avctx->block_align - put_bytes_count(&s->pb, 0);
av_assert0(i>=0); av_assert0(i>=0);
while(i--) while(i--)
put_bits(&s->pb, 8, 'N'); put_bits(&s->pb, 8, 'N');


+ 2
- 2
libavcodec/xsubenc.c View File

@@ -197,7 +197,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
h->rects[0]->linesize[0] * 2, h->rects[0]->linesize[0] * 2,
h->rects[0]->w, (h->rects[0]->h + 1) >> 1)) h->rects[0]->w, (h->rects[0]->h + 1) >> 1))
return AVERROR_BUFFER_TOO_SMALL; return AVERROR_BUFFER_TOO_SMALL;
bytestream_put_le16(&rlelenptr, put_bits_count(&pb) >> 3); // Length of first field
bytestream_put_le16(&rlelenptr, put_bytes_count(&pb, 0)); // Length of first field


if (xsub_encode_rle(&pb, h->rects[0]->data[0] + h->rects[0]->linesize[0], if (xsub_encode_rle(&pb, h->rects[0]->data[0] + h->rects[0]->linesize[0],
h->rects[0]->linesize[0] * 2, h->rects[0]->linesize[0] * 2,
@@ -211,7 +211,7 @@ FF_ENABLE_DEPRECATION_WARNINGS


flush_put_bits(&pb); flush_put_bits(&pb);


return hdr - buf + put_bits_count(&pb)/8;
return hdr - buf + put_bytes_output(&pb);
} }


static av_cold int xsub_encoder_init(AVCodecContext *avctx) static av_cold int xsub_encoder_init(AVCodecContext *avctx)


+ 1
- 1
libavfilter/vf_signature.c View File

@@ -561,7 +561,7 @@ static int binary_export(AVFilterContext *ctx, StreamContext *sc, const char* fi
} }


flush_put_bits(&buf); flush_put_bits(&buf);
fwrite(buffer, 1, put_bits_count(&buf)/8, f);
fwrite(buffer, 1, put_bytes_output(&buf), f);
fclose(f); fclose(f);
av_freep(&buffer); av_freep(&buffer);
return 0; return 0;


+ 1
- 1
libavformat/latmenc.c View File

@@ -225,7 +225,7 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)


flush_put_bits(&bs); flush_put_bits(&bs);


len = put_bits_count(&bs) >> 3;
len = put_bytes_output(&bs);


if (len > 0x1fff) if (len > 0x1fff)
goto too_large; goto too_large;


+ 1
- 1
libavformat/movenc.c View File

@@ -579,7 +579,7 @@ static int mov_write_eac3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
} }
} }
flush_put_bits(&pbc); flush_put_bits(&pbc);
size = put_bits_count(&pbc) >> 3;
size = put_bytes_output(&pbc);


avio_wb32(pb, size + 8); avio_wb32(pb, size + 8);
ffio_wfourcc(pb, "dec3"); ffio_wfourcc(pb, "dec3");


Loading…
Cancel
Save