This is the only place where it is used.
Unified · Split
| @@ -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 | ||
| 70 | void 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 | |||
| 92 | const FFCodec ff_flv_encoder = { | 70 | const 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)"), |
| @@ -21,12 +21,8 @@ · 20 unmodified lines | |||
| 21 | #ifndef AVCODEC_FLVENC_H | 21 | #ifndef AVCODEC_FLVENC_H |
| 22 | #define AVCODEC_FLVENC_H | 22 | #define AVCODEC_FLVENC_H |
| 23 | 23 | ||
| 24 | #include "put_bits.h" | ||
| 25 | |||
| 26 | typedef struct MPVMainEncContext MPVMainEncContext; | 24 | typedef struct MPVMainEncContext MPVMainEncContext; |
| 27 | 25 | ||
| 28 | int ff_flv_encode_picture_header(MPVMainEncContext *const m); | 26 | int ff_flv_encode_picture_header(MPVMainEncContext *const m); |
| 29 | void 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 */ |
| @@ -417,6 +417,28 @@ void ff_clean_h263_qscales(MPVEncContext *const s) · 416 unmodified lines | |||
| 417 | 417 | ||
| 418 | static const int dquant_code[5]= {1,0,9,2,3}; | 418 | static const int dquant_code[5]= {1,0,9,2,3}; |
| 419 | 419 | ||
| 420 | static 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 block | 444 | * @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); |