History

avcodec/mpeg12enc: Simplify writing bits

Andreas Rheinhardt committed 1 year ago

Commit 6e225121 parent d5db4ee1 file · +4 −12Browse files

Unified · Split

libavcodec/mpeg12enc.c+4−12
@@ -594,10 +594,8 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s) · 593 unmodified lines
594594
595595 if (fpa_type != 0) {
596596 put_header(s, USER_START_CODE);
597− put_bits(&s->pb, 8, 'J'); // S3D_video_format_signaling_identifier
598− put_bits(&s->pb, 8, 'P');
599− put_bits(&s->pb, 8, '3');
600− put_bits(&s->pb, 8, 'D');
597+ // S3D_video_format_signaling_identifier
598+ put_bits32(&s->pb, MKBETAG('J','P','3','D'));
601599 put_bits(&s->pb, 8, 0x03); // S3D_video_format_length
602600
603601 put_bits(&s->pb, 1, 1); // reserved_bit
@@ -612,21 +610,15 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s) · 8 unmodified lines
612610 AV_FRAME_DATA_A53_CC);
613611 if (side_data) {
614612 if (side_data->size <= A53_MAX_CC_COUNT * 3 && side_data->size % 3 == 0) {
615− int i = 0;
616−
617613 put_header (s, USER_START_CODE);
618614
619− put_bits(&s->pb, 8, 'G'); // user_identifier
620− put_bits(&s->pb, 8, 'A');
621− put_bits(&s->pb, 8, '9');
622− put_bits(&s->pb, 8, '4');
615+ put_bits32(&s->pb, MKBETAG('G','A','9','4')); // user_identifier
623616 put_bits(&s->pb, 8, 3); // user_data_type_code
624617 put_bits(&s->pb, 8,
625618 (side_data->size / 3 & A53_MAX_CC_COUNT) | 0x40); // flags, cc_count
626619 put_bits(&s->pb, 8, 0xff); // em_data
627620
628− for (i = 0; i < side_data->size; i++)
629− put_bits(&s->pb, 8, side_data->data[i]);
621+ ff_copy_bits(&s->pb, side_data->data, side_data->size);
630622
631623 put_bits(&s->pb, 8, 0xff); // marker_bits
632624 } else {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t