[FFmpeg-devel] [PATCH 1/4] h261, h263 decoders: convert to RL_VLC.
Michael Niedermayer
michaelni at gmx.at
Sun Aug 31 21:32:45 CEST 2014
On Sun, Aug 31, 2014 at 04:48:41PM +0200, Reimar Döffinger wrote:
> Some additional optimizations in following patch.
>
> Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> ---
> libavcodec/flv.h | 1 -
> libavcodec/flvdec.c | 12 ----------
> libavcodec/h261dec.c | 27 ++++++++++++++---------
> libavcodec/ituh263dec.c | 58 ++++++++++++++++++++++++++++++++++++-------------
> 4 files changed, 60 insertions(+), 38 deletions(-)
>
> diff --git a/libavcodec/flv.h b/libavcodec/flv.h
> index 16bc88b..df50820 100644
> --- a/libavcodec/flv.h
> +++ b/libavcodec/flv.h
> @@ -28,6 +28,5 @@ void ff_flv_encode_picture_header(MpegEncContext * s, int picture_number);
> void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level, int run, int last);
>
> int ff_flv_decode_picture_header(MpegEncContext *s);
> -void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last);
>
> #endif /* AVCODEC_FLV_H */
> diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
> index 3b048f6..db413f2 100644
> --- a/libavcodec/flvdec.c
> +++ b/libavcodec/flvdec.c
> @@ -22,18 +22,6 @@
> #include "flv.h"
> #include "libavutil/imgutils.h"
>
> -void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last)
> -{
> - int is11 = get_bits1(gb);
> - *last = get_bits1(gb);
> - *run = get_bits(gb, 6);
> - if (is11) {
> - *level = get_sbits(gb, 11);
> - } else {
> - *level = get_sbits(gb, 7);
> - }
> -}
> -
> int ff_flv_decode_picture_header(MpegEncContext *s)
> {
> int format, width, height;
> diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
> index 301ecc1..5f0eb59 100644
> --- a/libavcodec/h261dec.c
> +++ b/libavcodec/h261dec.c
> @@ -258,7 +258,7 @@ static int decode_mv_component(GetBitContext *gb, int v)
> static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded)
> {
> MpegEncContext *const s = &h->s;
> - int code, level, i, j, run;
> + int level, i, j, run;
> RLTable *rl = &ff_h261_rl_tcoeff;
> const uint8_t *scan_table;
>
> @@ -303,27 +303,32 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded)
> s->block_last_index[n] = i - 1;
> return 0;
> }
> + {
> + OPEN_READER(re, &s->gb);
> for (;;) {
> - code = get_vlc2(&s->gb, rl->vlc.table, TCOEFF_VLC_BITS, 2);
> - if (code < 0) {
> + UPDATE_CACHE(re, &s->gb);
> + GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TCOEFF_VLC_BITS, 2, 0);
> + if (run == 66 && level) {
> av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n",
> s->mb_x, s->mb_y);
> return -1;
> }
> - if (code == rl->n) {
> + if (run == 66) {
the "if (run == 66 && level) {" could be put under run == 66, if thats
faster
though maybe better as a seperate patch
patch should be ok
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140831/e17ec727/attachment.asc>
More information about the ffmpeg-devel
mailing list