History

avcodec/flvenc: Move ff_flv2_encode_ac_esc() to ituh263enc.c

This is the only place where it is used.

Andreas Rheinhardt committed 1 year ago

Commit 514e5ea1 parent 61d34c23 files · +23 −27Browse files

Unified · Split

3 files
  1. libavcodec/flvenc.c +0 −22
  2. libavcodec/flvenc.h +0 −4
  3. libavcodec/ituh263enc.c +23 −1
libavcodec/flvenc.c+0−22
@@ -67,28 +67,6 @@ int ff_flv_encode_picture_header(MPVMainEncContext *const m) · 66 unmodified lines
67 return 0;67 return 0;
68}68}
69 69
70void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level,
71 int run, int last)
72{
73 unsigned code;
74 int bits;
75 if (level < 64) { // 7-bit level
76 bits = 1 + 1 + 6 + 7;
77 code = (0 << (1 + 6 + 7)) |
78 (last << (6 + 7)) |
79 (run << 7) |
80 (slevel & 0x7f);
81 } else {
82 /* 11-bit level */
83 bits = 1 + 1 + 6 + 11;
84 code = (1 << (1 + 6 + 11)) |
85 (last << (6 + 11)) |
86 (run << 11) |
87 (slevel & 0x7ff);
88 }
89 put_bits(pb, bits, code);
90}
91
92const FFCodec ff_flv_encoder = {70const FFCodec ff_flv_encoder = {
93 .p.name = "flv",71 .p.name = "flv",
94 CODEC_LONG_NAME("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"),72 CODEC_LONG_NAME("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"),
libavcodec/flvenc.h+0−4
@@ -21,12 +21,8 @@ · 20 unmodified lines
21#ifndef AVCODEC_FLVENC_H21#ifndef AVCODEC_FLVENC_H
22#define AVCODEC_FLVENC_H22#define AVCODEC_FLVENC_H
23 23
24#include "put_bits.h"
25
26typedef struct MPVMainEncContext MPVMainEncContext;24typedef struct MPVMainEncContext MPVMainEncContext;
27 25
28int ff_flv_encode_picture_header(MPVMainEncContext *const m);26int ff_flv_encode_picture_header(MPVMainEncContext *const m);
29void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level, int run,
30 int last);
31 27
32#endif /* AVCODEC_FLV_H */28#endif /* AVCODEC_FLV_H */
libavcodec/ituh263enc.c+23−1
@@ -417,6 +417,28 @@ void ff_clean_h263_qscales(MPVEncContext *const s) · 416 unmodified lines
417 417
418static const int dquant_code[5]= {1,0,9,2,3};418static const int dquant_code[5]= {1,0,9,2,3};
419 419
420static void flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level,
421 int run, int last)
422{
423 unsigned code;
424 int bits;
425 if (level < 64) { // 7-bit level
426 bits = 1 + 1 + 6 + 7;
427 code = (0 << (1 + 6 + 7)) |
428 (last << (6 + 7)) |
429 (run << 7) |
430 (slevel & 0x7f);
431 } else {
432 /* 11-bit level */
433 bits = 1 + 1 + 6 + 11;
434 code = (1 << (1 + 6 + 11)) |
435 (last << (6 + 11)) |
436 (run << 11) |
437 (slevel & 0x7ff);
438 }
439 put_bits(pb, bits, code);
440}
441
420/**442/**
421 * Encode an 8x8 block.443 * Encode an 8x8 block.
422 * @param block the 8x8 block444 * @param block the 8x8 block
@@ -522,7 +544,7 @@ static void h263_encode_block(MPVEncContext *const s, int16_t block[], int n) · 99 unmodified lines
522 put_sbits(&s->pb, 6, slevel>>5);544 put_sbits(&s->pb, 6, slevel>>5);
523 }545 }
524 } else {546 } else {
525 ff_flv2_encode_ac_esc(&s->pb, slevel, level, run, last);547 flv2_encode_ac_esc(&s->pb, slevel, level, run, last);
526 }548 }
527 } else {549 } else {
528 put_bits(&s->pb, 1, sign);550 put_bits(&s->pb, 1, sign);

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