]> git.sesse.net Git - ffmpeg/blob - libavcodec/pgssubdec.c
lavc: Remove deprecated XvMC support hacks
[ffmpeg] / libavcodec / pgssubdec.c
1 /*
2  * PGS subtitle decoder
3  * Copyright (c) 2009 Stephen Backway
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21
22 /**
23  * @file
24  * PGS subtitle decoder
25  */
26
27 #include "avcodec.h"
28 #include "bytestream.h"
29 #include "internal.h"
30 #include "mathops.h"
31
32 #include "libavutil/colorspace.h"
33 #include "libavutil/imgutils.h"
34
35 #define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
36 #define MAX_EPOCH_PALETTES 8   // Max 8 allowed per PGS epoch
37 #define MAX_EPOCH_OBJECTS  64  // Max 64 allowed per PGS epoch
38 #define MAX_OBJECT_REFS    2   // Max objects per display set
39
40 enum SegmentType {
41     PALETTE_SEGMENT      = 0x14,
42     OBJECT_SEGMENT       = 0x15,
43     PRESENTATION_SEGMENT = 0x16,
44     WINDOW_SEGMENT       = 0x17,
45     DISPLAY_SEGMENT      = 0x80,
46 };
47
48 typedef struct PGSSubObjectRef {
49     int     id;
50     int     window_id;
51     uint8_t composition_flag;
52     int     x;
53     int     y;
54     int     crop_x;
55     int     crop_y;
56     int     crop_w;
57     int     crop_h;
58 } PGSSubObjectRef;
59
60 typedef struct PGSSubPresentation {
61     int id_number;
62     int palette_id;
63     int object_count;
64     PGSSubObjectRef objects[MAX_OBJECT_REFS];
65     int64_t pts;
66 } PGSSubPresentation;
67
68 typedef struct PGSSubObject {
69     int          id;
70     int          w;
71     int          h;
72     uint8_t      *rle;
73     unsigned int rle_buffer_size, rle_data_len;
74     unsigned int rle_remaining_len;
75 } PGSSubObject;
76
77 typedef struct PGSSubObjects {
78     int          count;
79     PGSSubObject object[MAX_EPOCH_OBJECTS];
80 } PGSSubObjects;
81
82 typedef struct PGSSubPalette {
83     int         id;
84     uint32_t    clut[256];
85 } PGSSubPalette;
86
87 typedef struct PGSSubPalettes {
88     int           count;
89     PGSSubPalette palette[MAX_EPOCH_PALETTES];
90 } PGSSubPalettes;
91
92 typedef struct PGSSubContext {
93     PGSSubPresentation presentation;
94     PGSSubPalettes     palettes;
95     PGSSubObjects      objects;
96 } PGSSubContext;
97
98 static void flush_cache(AVCodecContext *avctx)
99 {
100     PGSSubContext *ctx = avctx->priv_data;
101     int i;
102
103     for (i = 0; i < ctx->objects.count; i++) {
104         av_freep(&ctx->objects.object[i].rle);
105         ctx->objects.object[i].rle_buffer_size  = 0;
106         ctx->objects.object[i].rle_remaining_len  = 0;
107     }
108     ctx->objects.count = 0;
109     ctx->palettes.count = 0;
110 }
111
112 static PGSSubObject * find_object(int id, PGSSubObjects *objects)
113 {
114     int i;
115
116     for (i = 0; i < objects->count; i++) {
117         if (objects->object[i].id == id)
118             return &objects->object[i];
119     }
120     return NULL;
121 }
122
123 static PGSSubPalette * find_palette(int id, PGSSubPalettes *palettes)
124 {
125     int i;
126
127     for (i = 0; i < palettes->count; i++) {
128         if (palettes->palette[i].id == id)
129             return &palettes->palette[i];
130     }
131     return NULL;
132 }
133
134 static av_cold int init_decoder(AVCodecContext *avctx)
135 {
136     avctx->pix_fmt = AV_PIX_FMT_PAL8;
137
138     return 0;
139 }
140
141 static av_cold int close_decoder(AVCodecContext *avctx)
142 {
143     flush_cache(avctx);
144
145     return 0;
146 }
147
148 /**
149  * Decode the RLE data.
150  *
151  * The subtitle is stored as an Run Length Encoded image.
152  *
153  * @param avctx contains the current codec context
154  * @param sub pointer to the processed subtitle data
155  * @param buf pointer to the RLE data to process
156  * @param buf_size size of the RLE data to process
157  */
158 static int decode_rle(AVCodecContext *avctx, AVSubtitleRect *rect,
159                       const uint8_t *buf, unsigned int buf_size)
160 {
161     const uint8_t *rle_bitmap_end;
162     int pixel_count, line_count;
163
164     rle_bitmap_end = buf + buf_size;
165
166     rect->data[0] = av_malloc(rect->w * rect->h);
167
168     if (!rect->data[0])
169         return AVERROR(ENOMEM);
170
171     pixel_count = 0;
172     line_count  = 0;
173
174     while (buf < rle_bitmap_end && line_count < rect->h) {
175         uint8_t flags, color;
176         int run;
177
178         color = bytestream_get_byte(&buf);
179         run   = 1;
180
181         if (color == 0x00) {
182             flags = bytestream_get_byte(&buf);
183             run   = flags & 0x3f;
184             if (flags & 0x40)
185                 run = (run << 8) + bytestream_get_byte(&buf);
186             color = flags & 0x80 ? bytestream_get_byte(&buf) : 0;
187         }
188
189         if (run > 0 && pixel_count + run <= rect->w * rect->h) {
190             memset(rect->data[0] + pixel_count, color, run);
191             pixel_count += run;
192         } else if (!run) {
193             /*
194              * New Line. Check if correct pixels decoded, if not display warning
195              * and adjust bitmap pointer to correct new line position.
196              */
197             if (pixel_count % rect->w > 0) {
198                 av_log(avctx, AV_LOG_ERROR, "Decoded %d pixels, when line should be %d pixels\n",
199                        pixel_count % rect->w, rect->w);
200                 if (avctx->err_recognition & AV_EF_EXPLODE) {
201                     return AVERROR_INVALIDDATA;
202                 }
203             }
204             line_count++;
205         }
206     }
207
208     if (pixel_count < rect->w * rect->h) {
209         av_log(avctx, AV_LOG_ERROR, "Insufficient RLE data for subtitle\n");
210         return AVERROR_INVALIDDATA;
211     }
212
213     ff_dlog(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, rect->w * rect->h);
214
215     return 0;
216 }
217
218 /**
219  * Parse the picture segment packet.
220  *
221  * The picture segment contains details on the sequence id,
222  * width, height and Run Length Encoded (RLE) bitmap data.
223  *
224  * @param avctx contains the current codec context
225  * @param buf pointer to the packet to process
226  * @param buf_size size of packet to process
227  */
228 static int parse_object_segment(AVCodecContext *avctx,
229                                   const uint8_t *buf, int buf_size)
230 {
231     PGSSubContext *ctx = avctx->priv_data;
232     PGSSubObject *object;
233
234     uint8_t sequence_desc;
235     unsigned int rle_bitmap_len, width, height;
236     int id;
237
238     if (buf_size <= 4)
239         return AVERROR_INVALIDDATA;
240     buf_size -= 4;
241
242     id = bytestream_get_be16(&buf);
243     object = find_object(id, &ctx->objects);
244     if (!object) {
245         if (ctx->objects.count >= MAX_EPOCH_OBJECTS) {
246             av_log(avctx, AV_LOG_ERROR, "Too many objects in epoch\n");
247             return AVERROR_INVALIDDATA;
248         }
249         object = &ctx->objects.object[ctx->objects.count++];
250         object->id = id;
251     }
252
253     /* skip object version number */
254     buf += 1;
255
256     /* Read the Sequence Description to determine if start of RLE data or appended to previous RLE */
257     sequence_desc = bytestream_get_byte(&buf);
258
259     if (!(sequence_desc & 0x80)) {
260         /* Additional RLE data */
261         if (buf_size > object->rle_remaining_len)
262             return AVERROR_INVALIDDATA;
263
264         memcpy(object->rle + object->rle_data_len, buf, buf_size);
265         object->rle_data_len += buf_size;
266         object->rle_remaining_len -= buf_size;
267
268         return 0;
269     }
270
271     if (buf_size <= 7)
272         return AVERROR_INVALIDDATA;
273     buf_size -= 7;
274
275     /* Decode rle bitmap length, stored size includes width/height data */
276     rle_bitmap_len = bytestream_get_be24(&buf) - 2*2;
277
278     if (buf_size > rle_bitmap_len) {
279         av_log(avctx, AV_LOG_ERROR,
280                "Buffer dimension %d larger than the expected RLE data %d\n",
281                buf_size, rle_bitmap_len);
282         return AVERROR_INVALIDDATA;
283     }
284
285     /* Get bitmap dimensions from data */
286     width  = bytestream_get_be16(&buf);
287     height = bytestream_get_be16(&buf);
288
289     /* Make sure the bitmap is not too large */
290     if (avctx->width < width || avctx->height < height) {
291         av_log(avctx, AV_LOG_ERROR, "Bitmap dimensions larger than video.\n");
292         return AVERROR_INVALIDDATA;
293     }
294
295     object->w = width;
296     object->h = height;
297
298     av_fast_malloc(&object->rle, &object->rle_buffer_size, rle_bitmap_len);
299
300     if (!object->rle) {
301         object->rle_data_len      = 0;
302         object->rle_remaining_len = 0;
303         return AVERROR(ENOMEM);
304     }
305
306     memcpy(object->rle, buf, buf_size);
307     object->rle_data_len = buf_size;
308     object->rle_remaining_len = rle_bitmap_len - buf_size;
309
310     return 0;
311 }
312
313 /**
314  * Parse the palette segment packet.
315  *
316  * The palette segment contains details of the palette,
317  * a maximum of 256 colors can be defined.
318  *
319  * @param avctx contains the current codec context
320  * @param buf pointer to the packet to process
321  * @param buf_size size of packet to process
322  */
323 static int parse_palette_segment(AVCodecContext *avctx,
324                                   const uint8_t *buf, int buf_size)
325 {
326     PGSSubContext *ctx = avctx->priv_data;
327     PGSSubPalette *palette;
328
329     const uint8_t *buf_end = buf + buf_size;
330     const uint8_t *cm      = ff_crop_tab + MAX_NEG_CROP;
331     int color_id;
332     int y, cb, cr, alpha;
333     int r, g, b, r_add, g_add, b_add;
334     int id;
335
336     id  = bytestream_get_byte(&buf);
337     palette = find_palette(id, &ctx->palettes);
338     if (!palette) {
339         if (ctx->palettes.count >= MAX_EPOCH_PALETTES) {
340             av_log(avctx, AV_LOG_ERROR, "Too many palettes in epoch\n");
341             return AVERROR_INVALIDDATA;
342         }
343         palette = &ctx->palettes.palette[ctx->palettes.count++];
344         palette->id  = id;
345     }
346
347     /* Skip palette version */
348     buf += 1;
349
350     while (buf < buf_end) {
351         color_id  = bytestream_get_byte(&buf);
352         y         = bytestream_get_byte(&buf);
353         cr        = bytestream_get_byte(&buf);
354         cb        = bytestream_get_byte(&buf);
355         alpha     = bytestream_get_byte(&buf);
356
357         /* Default to BT.709 colorspace. In case of <= 576 height use BT.601 */
358         if (avctx->height <= 0 || avctx->height > 576) {
359             YUV_TO_RGB1_CCIR_BT709(cb, cr);
360         } else {
361             YUV_TO_RGB1_CCIR(cb, cr);
362         }
363
364         YUV_TO_RGB2_CCIR(r, g, b, y);
365
366         ff_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);
367
368         /* Store color in palette */
369         palette->clut[color_id] = RGBA(r,g,b,alpha);
370     }
371     return 0;
372 }
373
374 /**
375  * Parse the presentation segment packet.
376  *
377  * The presentation segment contains details on the video
378  * width, video height, x & y subtitle position.
379  *
380  * @param avctx contains the current codec context
381  * @param buf pointer to the packet to process
382  * @param buf_size size of packet to process
383  * @todo TODO: Implement cropping
384  */
385 static int parse_presentation_segment(AVCodecContext *avctx,
386                                       const uint8_t *buf, int buf_size,
387                                       int64_t pts)
388 {
389     PGSSubContext *ctx = avctx->priv_data;
390
391     int i, state, ret;
392
393     // Video descriptor
394     int w = bytestream_get_be16(&buf);
395     int h = bytestream_get_be16(&buf);
396
397     ctx->presentation.pts = pts;
398
399     ff_dlog(avctx, "Video Dimensions %dx%d\n",
400             w, h);
401     ret = ff_set_dimensions(avctx, w, h);
402     if (ret < 0)
403         return ret;
404
405     /* Skip 1 bytes of unknown, frame rate */
406     buf++;
407
408     // Composition descriptor
409     ctx->presentation.id_number = bytestream_get_be16(&buf);
410     /*
411      * state is a 2 bit field that defines pgs epoch boundaries
412      * 00 - Normal, previously defined objects and palettes are still valid
413      * 01 - Acquisition point, previous objects and palettes can be released
414      * 10 - Epoch start, previous objects and palettes can be released
415      * 11 - Epoch continue, previous objects and palettes can be released
416      *
417      * reserved 6 bits discarded
418      */
419     state = bytestream_get_byte(&buf) >> 6;
420     if (state != 0) {
421         flush_cache(avctx);
422     }
423
424     /*
425      * skip palette_update_flag (0x80),
426      */
427     buf += 1;
428     ctx->presentation.palette_id = bytestream_get_byte(&buf);
429     ctx->presentation.object_count = bytestream_get_byte(&buf);
430     if (ctx->presentation.object_count > MAX_OBJECT_REFS) {
431         av_log(avctx, AV_LOG_ERROR,
432                "Invalid number of presentation objects %d\n",
433                ctx->presentation.object_count);
434         ctx->presentation.object_count = 2;
435         if (avctx->err_recognition & AV_EF_EXPLODE) {
436             return AVERROR_INVALIDDATA;
437         }
438     }
439
440     for (i = 0; i < ctx->presentation.object_count; i++)
441     {
442         ctx->presentation.objects[i].id = bytestream_get_be16(&buf);
443         ctx->presentation.objects[i].window_id = bytestream_get_byte(&buf);
444         ctx->presentation.objects[i].composition_flag = bytestream_get_byte(&buf);
445
446         ctx->presentation.objects[i].x = bytestream_get_be16(&buf);
447         ctx->presentation.objects[i].y = bytestream_get_be16(&buf);
448
449         // If cropping
450         if (ctx->presentation.objects[i].composition_flag & 0x80) {
451             ctx->presentation.objects[i].crop_x = bytestream_get_be16(&buf);
452             ctx->presentation.objects[i].crop_y = bytestream_get_be16(&buf);
453             ctx->presentation.objects[i].crop_w = bytestream_get_be16(&buf);
454             ctx->presentation.objects[i].crop_h = bytestream_get_be16(&buf);
455         }
456
457         ff_dlog(avctx, "Subtitle Placement x=%d, y=%d\n",
458                 ctx->presentation.objects[i].x, ctx->presentation.objects[i].y);
459
460         if (ctx->presentation.objects[i].x > avctx->width ||
461             ctx->presentation.objects[i].y > avctx->height) {
462             av_log(avctx, AV_LOG_ERROR, "Subtitle out of video bounds. x = %d, y = %d, video width = %d, video height = %d.\n",
463                    ctx->presentation.objects[i].x,
464                    ctx->presentation.objects[i].y,
465                     avctx->width, avctx->height);
466             ctx->presentation.objects[i].x = 0;
467             ctx->presentation.objects[i].y = 0;
468             if (avctx->err_recognition & AV_EF_EXPLODE) {
469                 return AVERROR_INVALIDDATA;
470             }
471         }
472     }
473
474     return 0;
475 }
476
477 /**
478  * Parse the display segment packet.
479  *
480  * The display segment controls the updating of the display.
481  *
482  * @param avctx contains the current codec context
483  * @param data pointer to the data pertaining the subtitle to display
484  * @param buf pointer to the packet to process
485  * @param buf_size size of packet to process
486  */
487 static int display_end_segment(AVCodecContext *avctx, void *data,
488                                const uint8_t *buf, int buf_size)
489 {
490     AVSubtitle    *sub = data;
491     PGSSubContext *ctx = avctx->priv_data;
492     PGSSubPalette *palette;
493     int i, ret;
494
495     memset(sub, 0, sizeof(*sub));
496     sub->pts = ctx->presentation.pts;
497     sub->start_display_time = 0;
498     // There is no explicit end time for PGS subtitles.  The end time
499     // is defined by the start of the next sub which may contain no
500     // objects (i.e. clears the previous sub)
501     sub->end_display_time   = UINT32_MAX;
502     sub->format             = 0;
503
504     // Blank if last object_count was 0.
505     if (!ctx->presentation.object_count)
506         return 1;
507     sub->rects = av_mallocz(sizeof(*sub->rects) * ctx->presentation.object_count);
508     if (!sub->rects) {
509         return AVERROR(ENOMEM);
510     }
511     palette = find_palette(ctx->presentation.palette_id, &ctx->palettes);
512     if (!palette) {
513         // Missing palette.  Should only happen with damaged streams.
514         av_log(avctx, AV_LOG_ERROR, "Invalid palette id %d\n",
515                ctx->presentation.palette_id);
516         avsubtitle_free(sub);
517         return AVERROR_INVALIDDATA;
518     }
519     for (i = 0; i < ctx->presentation.object_count; i++) {
520         PGSSubObject *object;
521
522         sub->rects[i]  = av_mallocz(sizeof(*sub->rects[0]));
523         if (!sub->rects[i]) {
524             avsubtitle_free(sub);
525             return AVERROR(ENOMEM);
526         }
527         sub->num_rects++;
528         sub->rects[i]->type = SUBTITLE_BITMAP;
529
530         /* Process bitmap */
531         object = find_object(ctx->presentation.objects[i].id, &ctx->objects);
532         if (!object) {
533             // Missing object.  Should only happen with damaged streams.
534             av_log(avctx, AV_LOG_ERROR, "Invalid object id %d\n",
535                    ctx->presentation.objects[i].id);
536             if (avctx->err_recognition & AV_EF_EXPLODE) {
537                 avsubtitle_free(sub);
538                 return AVERROR_INVALIDDATA;
539             }
540             // Leaves rect empty with 0 width and height.
541             continue;
542         }
543         if (ctx->presentation.objects[i].composition_flag & 0x40)
544             sub->rects[i]->flags |= AV_SUBTITLE_FLAG_FORCED;
545
546         sub->rects[i]->x    = ctx->presentation.objects[i].x;
547         sub->rects[i]->y    = ctx->presentation.objects[i].y;
548         sub->rects[i]->w    = object->w;
549         sub->rects[i]->h    = object->h;
550
551         sub->rects[i]->linesize[0] = object->w;
552
553         if (object->rle) {
554             if (object->rle_remaining_len) {
555                 av_log(avctx, AV_LOG_ERROR, "RLE data length %u is %u bytes shorter than expected\n",
556                        object->rle_data_len, object->rle_remaining_len);
557                 if (avctx->err_recognition & AV_EF_EXPLODE) {
558                     avsubtitle_free(sub);
559                     return AVERROR_INVALIDDATA;
560                 }
561             }
562             ret = decode_rle(avctx, sub->rects[i], object->rle, object->rle_data_len);
563             if (ret < 0) {
564                 if ((avctx->err_recognition & AV_EF_EXPLODE) ||
565                     ret == AVERROR(ENOMEM)) {
566                     avsubtitle_free(sub);
567                     return ret;
568                 }
569                 sub->rects[i]->w = 0;
570                 sub->rects[i]->h = 0;
571                 continue;
572             }
573         }
574         /* Allocate memory for colors */
575         sub->rects[i]->nb_colors    = 256;
576         sub->rects[i]->data[1] = av_mallocz(AVPALETTE_SIZE);
577         if (!sub->rects[i]->data[1]) {
578             avsubtitle_free(sub);
579             return AVERROR(ENOMEM);
580         }
581
582 #if FF_API_AVPICTURE
583 FF_DISABLE_DEPRECATION_WARNINGS
584 {
585         AVSubtitleRect *rect;
586         int j;
587         rect = sub->rects[i];
588         for (j = 0; j < 4; j++) {
589             rect->pict.data[j] = rect->data[j];
590             rect->pict.linesize[j] = rect->linesize[j];
591         }
592 }
593 FF_ENABLE_DEPRECATION_WARNINGS
594 #endif
595
596         memcpy(sub->rects[i]->data[1], palette->clut, sub->rects[i]->nb_colors * sizeof(uint32_t));
597
598     }
599     return 1;
600 }
601
602 static int decode(AVCodecContext *avctx, void *data, int *data_size,
603                   AVPacket *avpkt)
604 {
605     const uint8_t *buf = avpkt->data;
606     int buf_size       = avpkt->size;
607
608     const uint8_t *buf_end;
609     uint8_t       segment_type;
610     int           segment_length;
611     int i, ret;
612
613     ff_dlog(avctx, "PGS sub packet:\n");
614
615     for (i = 0; i < buf_size; i++) {
616         ff_dlog(avctx, "%02x ", buf[i]);
617         if (i % 16 == 15)
618             ff_dlog(avctx, "\n");
619     }
620
621     if (i & 15)
622         ff_dlog(avctx, "\n");
623
624     *data_size = 0;
625
626     /* Ensure that we have received at a least a segment code and segment length */
627     if (buf_size < 3)
628         return -1;
629
630     buf_end = buf + buf_size;
631
632     /* Step through buffer to identify segments */
633     while (buf < buf_end) {
634         segment_type   = bytestream_get_byte(&buf);
635         segment_length = bytestream_get_be16(&buf);
636
637         ff_dlog(avctx, "Segment Length %d, Segment Type %x\n", segment_length, segment_type);
638
639         if (segment_type != DISPLAY_SEGMENT && segment_length > buf_end - buf)
640             break;
641
642         ret = 0;
643         switch (segment_type) {
644         case PALETTE_SEGMENT:
645             ret = parse_palette_segment(avctx, buf, segment_length);
646             break;
647         case OBJECT_SEGMENT:
648             ret = parse_object_segment(avctx, buf, segment_length);
649             break;
650         case PRESENTATION_SEGMENT:
651             ret = parse_presentation_segment(avctx, buf, segment_length, avpkt->pts);
652             break;
653         case WINDOW_SEGMENT:
654             /*
655              * Window Segment Structure (No new information provided):
656              *     2 bytes: Unknown,
657              *     2 bytes: X position of subtitle,
658              *     2 bytes: Y position of subtitle,
659              *     2 bytes: Width of subtitle,
660              *     2 bytes: Height of subtitle.
661              */
662             break;
663         case DISPLAY_SEGMENT:
664             ret = display_end_segment(avctx, data, buf, segment_length);
665             if (ret >= 0)
666                 *data_size = ret;
667             break;
668         default:
669             av_log(avctx, AV_LOG_ERROR, "Unknown subtitle segment type 0x%x, length %d\n",
670                    segment_type, segment_length);
671             ret = AVERROR_INVALIDDATA;
672             break;
673         }
674         if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
675             return ret;
676
677         buf += segment_length;
678     }
679
680     return buf_size;
681 }
682
683 AVCodec ff_pgssub_decoder = {
684     .name           = "pgssub",
685     .long_name      = NULL_IF_CONFIG_SMALL("HDMV Presentation Graphic Stream subtitles"),
686     .type           = AVMEDIA_TYPE_SUBTITLE,
687     .id             = AV_CODEC_ID_HDMV_PGS_SUBTITLE,
688     .priv_data_size = sizeof(PGSSubContext),
689     .init           = init_decoder,
690     .close          = close_decoder,
691     .decode         = decode,
692 };