Lines Matching refs:ctx
438 static void init_sizes(SANMVideoContext *ctx, int width, int height)
440 ctx->width = width;
441 ctx->height = height;
442 ctx->npixels = width * height;
444 ctx->aligned_width = FFALIGN(width, 8);
445 ctx->aligned_height = FFALIGN(height, 8);
447 ctx->buf_size = ctx->aligned_width * ctx->aligned_height * sizeof(ctx->frm0[0]);
448 ctx->pitch = width;
451 static void destroy_buffers(SANMVideoContext *ctx)
453 av_freep(&ctx->frm0);
454 av_freep(&ctx->frm1);
455 av_freep(&ctx->frm2);
456 av_freep(&ctx->stored_frame);
457 av_freep(&ctx->rle_buf);
458 ctx->frm0_size =
459 ctx->frm1_size =
460 ctx->frm2_size = 0;
461 init_sizes(ctx, 0, 0);
464 static av_cold int init_buffers(SANMVideoContext *ctx)
466 av_fast_padded_mallocz(&ctx->frm0, &ctx->frm0_size, ctx->buf_size);
467 av_fast_padded_mallocz(&ctx->frm1, &ctx->frm1_size, ctx->buf_size);
468 av_fast_padded_mallocz(&ctx->frm2, &ctx->frm2_size, ctx->buf_size);
469 if (!ctx->version)
470 av_fast_padded_mallocz(&ctx->stored_frame,
471 &ctx->stored_frame_size, ctx->buf_size);
473 if (!ctx->frm0 || !ctx->frm1 || !ctx->frm2 ||
474 (!ctx->stored_frame && !ctx->version)) {
475 destroy_buffers(ctx);
482 static void rotate_bufs(SANMVideoContext *ctx, int rotate_code)
485 FFSWAP(uint16_t*, ctx->frm1, ctx->frm2);
486 FFSWAP(uint16_t*, ctx->frm2, ctx->frm0);
491 SANMVideoContext *ctx = avctx->priv_data;
493 ctx->avctx = avctx;
494 ctx->version = !avctx->extradata_size;
496 if (!ctx->version && avctx->extradata_size < 1026) {
501 avctx->pix_fmt = ctx->version ? AV_PIX_FMT_RGB565 : AV_PIX_FMT_PAL8;
503 init_sizes(ctx, avctx->width, avctx->height);
504 if (init_buffers(ctx)) {
509 make_glyphs(ctx->p4x4glyphs[0], glyph4_x, glyph4_y, 4);
510 make_glyphs(ctx->p8x8glyphs[0], glyph8_x, glyph8_y, 8);
512 if (!ctx->version) {
515 ctx->subversion = AV_RL16(avctx->extradata);
517 ctx->pal[i] = 0xFFU << 24 | AV_RL32(avctx->extradata + 2 + i * 4);
525 SANMVideoContext *ctx = avctx->priv_data;
527 destroy_buffers(ctx);
532 static int rle_decode(SANMVideoContext *ctx, uint8_t *dst, const int out_size)
537 opcode = bytestream2_get_byte(&ctx->gb);
539 if (run_len > left || bytestream2_get_bytes_left(&ctx->gb) <= 0)
543 color = bytestream2_get_byte(&ctx->gb);
546 if (bytestream2_get_bytes_left(&ctx->gb) < run_len)
548 bytestream2_get_bufferu(&ctx->gb, dst, run_len);
558 static int old_codec1(SANMVideoContext *ctx, int top,
561 uint8_t *dst = ((uint8_t *)ctx->frm0) + left + top * ctx->pitch;
567 if (bytestream2_get_bytes_left(&ctx->gb) < 2)
570 len = bytestream2_get_le16u(&ctx->gb);
571 end = bytestream2_tell(&ctx->gb) + len;
573 while (bytestream2_tell(&ctx->gb) < end) {
574 if (bytestream2_get_bytes_left(&ctx->gb) < 2)
577 code = bytestream2_get_byteu(&ctx->gb);
583 val = bytestream2_get_byteu(&ctx->gb);
588 if (bytestream2_get_bytes_left(&ctx->gb) < code)
591 val = bytestream2_get_byteu(&ctx->gb);
598 dst += ctx->pitch;
600 ctx->rotate_code = 0;
624 static int old_codec37(SANMVideoContext *ctx, int top,
627 ptrdiff_t stride = ctx->pitch;
631 int compr = bytestream2_get_byte(&ctx->gb);
632 int mvoff = bytestream2_get_byte(&ctx->gb);
633 int seq = bytestream2_get_le16(&ctx->gb);
634 uint32_t decoded_size = bytestream2_get_le32(&ctx->gb);
637 bytestream2_skip(&ctx->gb, 4);
638 flags = bytestream2_get_byte(&ctx->gb);
639 bytestream2_skip(&ctx->gb, 3);
641 if (decoded_size > ctx->height * stride - left - top * stride) {
642 decoded_size = ctx->height * stride - left - top * stride;
643 av_log(ctx->avctx, AV_LOG_WARNING, "Decoded size is too large.\n");
646 ctx->rotate_code = 0;
649 rotate_bufs(ctx, 1);
651 dst = ((uint8_t*)ctx->frm0) + left + top * stride;
652 prev = ((uint8_t*)ctx->frm2) + left + top * stride;
655 av_log(ctx->avctx, AV_LOG_ERROR, "Invalid motion base value %d.\n", mvoff);
662 bytestream2_get_buffer(&ctx->gb, dst, width);
665 memset(ctx->frm1, 0, ctx->height * stride);
666 memset(ctx->frm2, 0, ctx->height * stride);
669 if (rle_decode(ctx, dst, decoded_size))
671 memset(ctx->frm1, 0, ctx->frm1_size);
672 memset(ctx->frm2, 0, ctx->frm2_size);
685 if (bytestream2_get_bytes_left(&ctx->gb) < 1)
687 code = bytestream2_get_byteu(&ctx->gb);
690 if (bytestream2_get_bytes_left(&ctx->gb) < 16)
693 bytestream2_get_bufferu(&ctx->gb, dst + i + k * stride, 4);
696 if (bytestream2_get_bytes_left(&ctx->gb) < 4)
699 memset(dst + i + k * stride, bytestream2_get_byteu(&ctx->gb), 4);
702 if (bytestream2_get_bytes_left(&ctx->gb) < 1)
704 t = bytestream2_get_byteu(&ctx->gb);
710 if (bytestream2_get_bytes_left(&ctx->gb) < 1)
712 skip_run = bytestream2_get_byteu(&ctx->gb) + 1;
720 ctx->height, stride, i + mx, j + my);
736 code = bytestream2_get_byte(&ctx->gb);
738 if (bytestream2_get_bytes_left(&ctx->gb) < 16)
741 bytestream2_get_bufferu(&ctx->gb, dst + i + k * stride, 4);
743 if (bytestream2_get_bytes_left(&ctx->gb) < 1)
745 skip_run = bytestream2_get_byteu(&ctx->gb) + 1;
753 ctx->height, stride, i + mx, j + my);
762 avpriv_report_missing_feature(ctx->avctx,
770 static int process_block(SANMVideoContext *ctx, uint8_t *dst, uint8_t *prev1,
777 if (bytestream2_get_bytes_left(&ctx->gb) < 1)
780 code = bytestream2_get_byteu(&ctx->gb);
785 if (bytestream2_get_bytes_left(&ctx->gb) < 4)
787 dst[0] = bytestream2_get_byteu(&ctx->gb);
788 dst[1] = bytestream2_get_byteu(&ctx->gb);
789 dst[0 + stride] = bytestream2_get_byteu(&ctx->gb);
790 dst[1 + stride] = bytestream2_get_byteu(&ctx->gb);
793 if (process_block(ctx, dst, prev1, prev2, stride, tbl, size))
795 if (process_block(ctx, dst + size, prev1 + size, prev2 + size,
801 if (process_block(ctx, dst, prev1, prev2, stride, tbl, size))
803 if (process_block(ctx, dst + size, prev1 + size, prev2 + size,
809 if (bytestream2_get_bytes_left(&ctx->gb) < 1)
812 t = bytestream2_get_byteu(&ctx->gb);
817 if (bytestream2_get_bytes_left(&ctx->gb) < 3)
820 code = bytestream2_get_byteu(&ctx->gb);
821 pglyph = (size == 8) ? ctx->p8x8glyphs[code] : ctx->p4x4glyphs[code];
822 bytestream2_get_bufferu(&ctx->gb, colors, 2);
833 k = bytestream2_tell(&ctx->gb);
834 bytestream2_seek(&ctx->gb, tbl + (code & 7), SEEK_SET);
835 t = bytestream2_get_byte(&ctx->gb);
836 bytestream2_seek(&ctx->gb, k, SEEK_SET);
843 int index = prev2 - (const uint8_t *)ctx->frm2;
845 av_assert2(index >= 0 && index < (ctx->buf_size >> 1));
848 (ctx->buf_size >> 1) - index < mx + size + (my + size - 1) * stride) {
849 av_log(ctx->avctx, AV_LOG_ERROR, "MV is invalid.\n");
860 static int old_codec47(SANMVideoContext *ctx, int top,
865 ptrdiff_t stride = ctx->pitch;
866 uint8_t *dst = (uint8_t *)ctx->frm0 + left + top * stride;
867 uint8_t *prev1 = (uint8_t *)ctx->frm1;
868 uint8_t *prev2 = (uint8_t *)ctx->frm2;
869 int tbl_pos = bytestream2_tell(&ctx->gb);
870 int seq = bytestream2_get_le16(&ctx->gb);
871 int compr = bytestream2_get_byte(&ctx->gb);
872 int new_rot = bytestream2_get_byte(&ctx->gb);
873 int skip = bytestream2_get_byte(&ctx->gb);
875 bytestream2_skip(&ctx->gb, 9);
876 decoded_size = bytestream2_get_le32(&ctx->gb);
877 bytestream2_skip(&ctx->gb, 8);
879 if (decoded_size > ctx->height * stride - left - top * stride) {
880 decoded_size = ctx->height * stride - left - top * stride;
881 av_log(ctx->avctx, AV_LOG_WARNING, "Decoded size is too large.\n");
885 bytestream2_skip(&ctx->gb, 0x8080);
887 ctx->prev_seq = -1;
888 memset(prev1, 0, ctx->height * stride);
889 memset(prev2, 0, ctx->height * stride);
894 if (bytestream2_get_bytes_left(&ctx->gb) < width * height)
897 bytestream2_get_bufferu(&ctx->gb, dst, width);
902 if (bytestream2_get_bytes_left(&ctx->gb) < ((width + 1) >> 1) * ((height + 1) >> 1))
909 dst[stride + i + 1] = bytestream2_get_byteu(&ctx->gb);
915 if (seq == ctx->prev_seq + 1) {
918 if (process_block(ctx, dst + i, prev1 + i, prev2 + i, stride,
928 memcpy(ctx->frm0, ctx->frm2, ctx->pitch * ctx->height);
931 memcpy(ctx->frm0, ctx->frm1, ctx->pitch * ctx->height);
934 if (rle_decode(ctx, dst, decoded_size))
938 avpriv_report_missing_feature(ctx->avctx,
942 if (seq == ctx->prev_seq + 1)
943 ctx->rotate_code = new_rot;
945 ctx->rotate_code = 0;
946 ctx->prev_seq = seq;
951 static int process_frame_obj(SANMVideoContext *ctx)
953 uint16_t codec = bytestream2_get_le16u(&ctx->gb);
954 uint16_t left = bytestream2_get_le16u(&ctx->gb);
955 uint16_t top = bytestream2_get_le16u(&ctx->gb);
956 uint16_t w = bytestream2_get_le16u(&ctx->gb);
957 uint16_t h = bytestream2_get_le16u(&ctx->gb);
960 av_log(ctx->avctx, AV_LOG_ERROR, "Dimensions are invalid.\n");
964 if (ctx->width < left + w || ctx->height < top + h) {
965 int ret = ff_set_dimensions(ctx->avctx, FFMAX(left + w, ctx->width),
966 FFMAX(top + h, ctx->height));
969 init_sizes(ctx, FFMAX(left + w, ctx->width),
970 FFMAX(top + h, ctx->height));
971 if (init_buffers(ctx)) {
972 av_log(ctx->avctx, AV_LOG_ERROR, "Error resizing buffers.\n");
976 bytestream2_skip(&ctx->gb, 4);
981 return old_codec1(ctx, top, left, w, h);
983 return old_codec37(ctx, top, left, w, h);
985 return old_codec47(ctx, top, left, w, h);
987 avpriv_request_sample(ctx->avctx, "Subcodec %d", codec);
992 static int decode_0(SANMVideoContext *ctx)
994 uint16_t *frm = ctx->frm0;
997 if (bytestream2_get_bytes_left(&ctx->gb) < ctx->width * ctx->height * 2) {
998 av_log(ctx->avctx, AV_LOG_ERROR, "Insufficient data for raw frame.\n");
1001 for (y = 0; y < ctx->height; y++) {
1002 for (x = 0; x < ctx->width; x++)
1003 frm[x] = bytestream2_get_le16u(&ctx->gb);
1004 frm += ctx->pitch;
1009 static int decode_nop(SANMVideoContext *ctx)
1011 avpriv_request_sample(ctx->avctx, "Unknown/unsupported compression type");
1044 static int draw_glyph(SANMVideoContext *ctx, uint16_t *dst, int index,
1053 av_log(ctx->avctx, AV_LOG_ERROR, "Ignoring nonexistent glyph #%u.\n", index);
1057 pglyph = block_size == 8 ? ctx->p8x8glyphs[index] : ctx->p4x4glyphs[index];
1066 static int opcode_0xf7(SANMVideoContext *ctx, int cx, int cy, int block_size, ptrdiff_t pitch)
1068 uint16_t *dst = ctx->frm0 + cx + cy * ctx->pitch;
1073 if (bytestream2_get_bytes_left(&ctx->gb) < 4)
1076 indices = bytestream2_get_le32u(&ctx->gb);
1077 dst[0] = ctx->codebook[indices & 0xFF];
1079 dst[1] = ctx->codebook[indices & 0xFF];
1081 dst[pitch] = ctx->codebook[indices & 0xFF];
1083 dst[pitch + 1] = ctx->codebook[indices & 0xFF];
1088 if (bytestream2_get_bytes_left(&ctx->gb) < 3)
1091 glyph = bytestream2_get_byteu(&ctx->gb);
1092 bgcolor = ctx->codebook[bytestream2_get_byteu(&ctx->gb)];
1093 fgcolor = ctx->codebook[bytestream2_get_byteu(&ctx->gb)];
1095 draw_glyph(ctx, dst, glyph, fgcolor, bgcolor, block_size, pitch);
1100 static int opcode_0xf8(SANMVideoContext *ctx, int cx, int cy, int block_size, ptrdiff_t pitch)
1102 uint16_t *dst = ctx->frm0 + cx + cy * ctx->pitch;
1105 if (bytestream2_get_bytes_left(&ctx->gb) < 8)
1108 dst[0] = bytestream2_get_le16u(&ctx->gb);
1109 dst[1] = bytestream2_get_le16u(&ctx->gb);
1110 dst[pitch] = bytestream2_get_le16u(&ctx->gb);
1111 dst[pitch + 1] = bytestream2_get_le16u(&ctx->gb);
1116 if (bytestream2_get_bytes_left(&ctx->gb) < 5)
1119 glyph = bytestream2_get_byteu(&ctx->gb);
1120 bgcolor = bytestream2_get_le16u(&ctx->gb);
1121 fgcolor = bytestream2_get_le16u(&ctx->gb);
1123 draw_glyph(ctx, dst, glyph, fgcolor, bgcolor, block_size, pitch);
1128 static int good_mvec(SANMVideoContext *ctx, int cx, int cy, int mx, int my,
1131 int start_pos = cx + mx + (cy + my) * ctx->pitch;
1132 int end_pos = start_pos + (block_size - 1) * (ctx->pitch + 1);
1134 int good = start_pos >= 0 && end_pos < (ctx->buf_size >> 1);
1137 av_log(ctx->avctx, AV_LOG_ERROR,
1144 static int codec2subblock(SANMVideoContext *ctx, int cx, int cy, int blk_size)
1149 if (bytestream2_get_bytes_left(&ctx->gb) < 1)
1152 opcode = bytestream2_get_byteu(&ctx->gb);
1159 if (good_mvec(ctx, cx, cy, mx, my, blk_size)) {
1160 copy_block(ctx->frm0 + cx + ctx->pitch * cy,
1161 ctx->frm2 + cx + mx + ctx->pitch * (cy + my),
1162 blk_size, ctx->pitch);
1166 if (bytestream2_get_bytes_left(&ctx->gb) < 2)
1168 index = bytestream2_get_le16u(&ctx->gb);
1170 mx = index % ctx->width;
1171 my = index / ctx->width;
1173 if (good_mvec(ctx, cx, cy, mx, my, blk_size)) {
1174 copy_block(ctx->frm0 + cx + ctx->pitch * cy,
1175 ctx->frm2 + cx + mx + ctx->pitch * (cy + my),
1176 blk_size, ctx->pitch);
1180 copy_block(ctx->frm0 + cx + ctx->pitch * cy,
1181 ctx->frm1 + cx + ctx->pitch * cy,
1182 blk_size, ctx->pitch);
1185 opcode_0xf7(ctx, cx, cy, blk_size, ctx->pitch);
1189 opcode_0xf8(ctx, cx, cy, blk_size, ctx->pitch);
1195 fill_block(ctx->frm0 + cx + cy * ctx->pitch,
1196 ctx->small_codebook[opcode - 0xf9], blk_size, ctx->pitch);
1199 if (bytestream2_get_bytes_left(&ctx->gb) < 1)
1201 fill_block(ctx->frm0 + cx + cy * ctx->pitch,
1202 ctx->codebook[bytestream2_get_byteu(&ctx->gb)], blk_size, ctx->pitch);
1205 if (bytestream2_get_bytes_left(&ctx->gb) < 2)
1207 fill_block(ctx->frm0 + cx + cy * ctx->pitch,
1208 bytestream2_get_le16u(&ctx->gb), blk_size, ctx->pitch);
1212 opcode_0xf8(ctx, cx, cy, blk_size, ctx->pitch);
1215 if (codec2subblock(ctx, cx, cy, blk_size))
1217 if (codec2subblock(ctx, cx + blk_size, cy, blk_size))
1219 if (codec2subblock(ctx, cx, cy + blk_size, blk_size))
1221 if (codec2subblock(ctx, cx + blk_size, cy + blk_size, blk_size))
1229 static int decode_2(SANMVideoContext *ctx)
1233 for (cy = 0; cy < ctx->aligned_height; cy += 8)
1234 for (cx = 0; cx < ctx->aligned_width; cx += 8)
1235 if (ret = codec2subblock(ctx, cx, cy, 8))
1241 static int decode_3(SANMVideoContext *ctx)
1243 memcpy(ctx->frm0, ctx->frm2, ctx->frm2_size);
1247 static int decode_4(SANMVideoContext *ctx)
1249 memcpy(ctx->frm0, ctx->frm1, ctx->frm1_size);
1253 static int decode_5(SANMVideoContext *ctx)
1259 uint8_t *dst = (uint8_t*)ctx->frm0;
1261 if (rle_decode(ctx, dst, ctx->buf_size))
1265 npixels = ctx->npixels;
1266 frm = ctx->frm0;
1276 static int decode_6(SANMVideoContext *ctx)
1278 int npixels = ctx->npixels;
1279 uint16_t *frm = ctx->frm0;
1281 if (bytestream2_get_bytes_left(&ctx->gb) < npixels) {
1282 av_log(ctx->avctx, AV_LOG_ERROR, "Insufficient data for frame.\n");
1286 *frm++ = ctx->codebook[bytestream2_get_byteu(&ctx->gb)];
1291 static int decode_8(SANMVideoContext *ctx)
1293 uint16_t *pdest = ctx->frm0;
1295 long npixels = ctx->npixels;
1297 av_fast_malloc(&ctx->rle_buf, &ctx->rle_buf_size, npixels);
1298 if (!ctx->rle_buf) {
1299 av_log(ctx->avctx, AV_LOG_ERROR, "RLE buffer allocation failed.\n");
1302 rsrc = ctx->rle_buf;
1304 if (rle_decode(ctx, rsrc, npixels))
1308 *pdest++ = ctx->codebook[*rsrc++];
1313 typedef int (*frm_decoder)(SANMVideoContext *ctx);
1320 static int read_frame_header(SANMVideoContext *ctx, SANMFrameHeader *hdr)
1324 if ((ret = bytestream2_get_bytes_left(&ctx->gb)) < 560) {
1325 av_log(ctx->avctx, AV_LOG_ERROR, "Input frame too short (%d bytes).\n",
1329 bytestream2_skip(&ctx->gb, 8); // skip pad
1331 hdr->width = bytestream2_get_le32u(&ctx->gb);
1332 hdr->height = bytestream2_get_le32u(&ctx->gb);
1334 if (hdr->width != ctx->width || hdr->height != ctx->height) {
1335 avpriv_report_missing_feature(ctx->avctx, "Variable size frames");
1339 hdr->seq_num = bytestream2_get_le16u(&ctx->gb);
1340 hdr->codec = bytestream2_get_byteu(&ctx->gb);
1341 hdr->rotate_code = bytestream2_get_byteu(&ctx->gb);
1343 bytestream2_skip(&ctx->gb, 4); // skip pad
1346 ctx->small_codebook[i] = bytestream2_get_le16u(&ctx->gb);
1347 hdr->bg_color = bytestream2_get_le16u(&ctx->gb);
1349 bytestream2_skip(&ctx->gb, 2); // skip pad
1351 hdr->rle_output_size = bytestream2_get_le32u(&ctx->gb);
1353 ctx->codebook[i] = bytestream2_get_le16u(&ctx->gb);
1355 bytestream2_skip(&ctx->gb, 8); // skip pad
1368 static int copy_output(SANMVideoContext *ctx, SANMFrameHeader *hdr)
1371 const uint8_t *src = (uint8_t*) ctx->frm0;
1372 int ret, height = ctx->height;
1373 ptrdiff_t dstpitch, srcpitch = ctx->pitch * (hdr ? sizeof(ctx->frm0[0]) : 1);
1375 if ((ret = ff_get_buffer(ctx->avctx, ctx->frame, 0)) < 0)
1378 dst = ctx->frame->data[0];
1379 dstpitch = ctx->frame->linesize[0];
1393 SANMVideoContext *ctx = avctx->priv_data;
1396 ctx->frame = frame;
1397 bytestream2_init(&ctx->gb, pkt->data, pkt->size);
1399 if (!ctx->version) {
1402 while (bytestream2_get_bytes_left(&ctx->gb) >= 8) {
1406 sig = bytestream2_get_be32u(&ctx->gb);
1407 size = bytestream2_get_be32u(&ctx->gb);
1408 pos = bytestream2_tell(&ctx->gb);
1410 if (bytestream2_get_bytes_left(&ctx->gb) < size) {
1422 ctx->pal[i] = 0xFFU << 24 | bytestream2_get_be24u(&ctx->gb);
1427 if (ret = process_frame_obj(ctx))
1437 int t = (ctx->pal[i] >> (16 - j * 8)) & 0xFF;
1438 tmp[j] = av_clip_uint8((t * 129 + ctx->delta_pal[i * 3 + j]) >> 7);
1440 ctx->pal[i] = 0xFFU << 24 | AV_RB24(tmp);
1449 bytestream2_skipu(&ctx->gb, 4);
1451 ctx->delta_pal[i] = bytestream2_get_le16u(&ctx->gb);
1454 ctx->pal[i] = 0xFFU << 24 | bytestream2_get_be24u(&ctx->gb);
1456 memset(ctx->pal, 0, sizeof(ctx->pal));
1464 memcpy(ctx->frm0, ctx->stored_frame, ctx->buf_size);
1467 bytestream2_skip(&ctx->gb, size);
1473 bytestream2_seek(&ctx->gb, pos + size, SEEK_SET);
1475 bytestream2_skip(&ctx->gb, 1);
1478 memcpy(ctx->stored_frame, ctx->frm0, ctx->buf_size);
1479 if ((ret = copy_output(ctx, NULL)))
1481 memcpy(ctx->frame->data[1], ctx->pal, 1024);
1485 if ((ret = read_frame_header(ctx, &header)))
1488 ctx->rotate_code = header.rotate_code;
1489 if ((ctx->frame->key_frame = !header.seq_num)) {
1490 ctx->frame->pict_type = AV_PICTURE_TYPE_I;
1491 fill_frame(ctx->frm1, ctx->npixels, header.bg_color);
1492 fill_frame(ctx->frm2, ctx->npixels, header.bg_color);
1494 ctx->frame->pict_type = AV_PICTURE_TYPE_P;
1498 if ((ret = v1_decoders[header.codec](ctx))) {
1508 if ((ret = copy_output(ctx, &header)))
1511 if (ctx->rotate_code)
1512 rotate_bufs(ctx, ctx->rotate_code);