X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fkmvc.c;h=ccff678fa4467d179d481e310a211ed171c57e82;hb=aa237f45354799cdc34bdb06759e560dab3a0532;hp=e8f39fca15e498ed5a6bee38684343310c8e1f2f;hpb=b78e7197a81e193827cf2408fe25bc1f14843a72;p=ffmpeg diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c index e8f39fca15e..ccff678fa44 100644 --- a/libavcodec/kmvc.c +++ b/libavcodec/kmvc.c @@ -17,7 +17,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * */ /** @@ -28,8 +27,8 @@ #include #include -#include "common.h" #include "avcodec.h" +#include "bytestream.h" #define KMVC_KEYFRAME 0x80 #define KMVC_PALETTE 0x40 @@ -228,7 +227,7 @@ static void kmvc_decode_inter_8x8(KmvcContext * ctx, uint8_t * src, int w, int h static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, uint8_t * buf, int buf_size) { - KmvcContext *const ctx = (KmvcContext *) avctx->priv_data; + KmvcContext *const ctx = avctx->priv_data; uint8_t *out, *src; int i; int header; @@ -250,7 +249,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, uint if (buf[0] == 127) { buf += 3; for (i = 0; i < 127; i++) { - ctx->pal[i + (header & 0x81)] = (buf[0] << 16) | (buf[1] << 8) | buf[2]; + ctx->pal[i + (header & 0x81)] = AV_RB24(buf); buf += 4; } buf -= 127 * 4 + 3; @@ -275,8 +274,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, uint ctx->pic.palette_has_changed = 1; // palette starts from index 1 and has 127 entries for (i = 1; i <= ctx->palsize; i++) { - ctx->pal[i] = (buf[0] << 16) | (buf[1] << 8) | buf[2]; - buf += 3; + ctx->pal[i] = bytestream_get_be24(&buf); } } @@ -342,11 +340,10 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, uint */ static int decode_init(AVCodecContext * avctx) { - KmvcContext *const c = (KmvcContext *) avctx->priv_data; + KmvcContext *const c = avctx->priv_data; int i; c->avctx = avctx; - avctx->has_b_frames = 0; c->pic.data[0] = NULL; @@ -368,13 +365,13 @@ static int decode_init(AVCodecContext * avctx) av_log(NULL, 0, "Extradata missing, decoding may not work properly...\n"); c->palsize = 127; } else { - c->palsize = LE_16(avctx->extradata + 10); + c->palsize = AV_RL16(avctx->extradata + 10); } if (avctx->extradata_size == 1036) { // palette in extradata uint8_t *src = avctx->extradata + 12; for (i = 0; i < 256; i++) { - c->pal[i] = LE_32(src); + c->pal[i] = AV_RL32(src); src += 4; } c->setpal = 1; @@ -395,7 +392,7 @@ static int decode_init(AVCodecContext * avctx) */ static int decode_end(AVCodecContext * avctx) { - KmvcContext *const c = (KmvcContext *) avctx->priv_data; + KmvcContext *const c = avctx->priv_data; av_freep(&c->frm0); av_freep(&c->frm1);