+ avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
+ avctx->coded_frame->key_frame = 1;
+
+ init_put_bits(&pb, pkt->data, pkt->size);
+
+ for (y = 0; y < avctx->height; y++) {
+ uint8_t *luma = &p->data[0][y * p->linesize[0]];
+ uint8_t *cb = &p->data[1][y * p->linesize[1]];
+ uint8_t *cr = &p->data[2][y * p->linesize[2]];
+ for (x = 0; x < avctx->width; x += 4) {
+ put_bits(&pb, 5, luma[3] >> 3);
+ put_bits(&pb, 5, luma[2] >> 3);
+ put_bits(&pb, 5, luma[1] >> 3);
+ put_bits(&pb, 5, luma[0] >> 3);
+ luma += 4;
+ put_bits(&pb, 6, *(cb++) >> 2);
+ put_bits(&pb, 6, *(cr++) >> 2);
+ }
+ }
+
+ flush_put_bits(&pb);
+
+ pkt->size = put_bits_count(&pb) / 8;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;