2 * - CrystalHD decoder module -
4 * Copyright(C) 2010,2011 Philip Langdale <ffmpeg.philipl@overt.org>
6 * This file is part of FFmpeg.
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 * - Principles of Operation -
26 * The CrystalHD decoder operates at the bitstream level - which is an even
27 * higher level than the decoding hardware you typically see in modern GPUs.
28 * This means it has a very simple interface, in principle. You feed demuxed
29 * packets in one end and get decoded picture (fields/frames) out the other.
31 * Of course, nothing is ever that simple. Due, at the very least, to b-frame
32 * dependencies in the supported formats, the hardware has a delay between
33 * when a packet goes in, and when a picture comes out. Furthermore, this delay
34 * is not just a function of time, but also one of the dependency on additional
35 * frames being fed into the decoder to satisfy the b-frame dependencies.
37 * As such, the hardware can only be used effectively with a decode API that
38 * doesn't assume a 1:1 relationship between input packets and output frames.
39 * The new avcodec decode API is such an API (an m:n API) while the old one is
40 * 1:1. Consequently, we no longer support the old API, which allows us to avoid
41 * the vicious hacks that are required to approximate 1:1 operation.
44 /*****************************************************************************
46 ****************************************************************************/
48 #define _XOPEN_SOURCE 600
53 #include <libcrystalhd/bc_dts_types.h>
54 #include <libcrystalhd/bc_dts_defs.h>
55 #include <libcrystalhd/libcrystalhd_if.h>
60 #include "libavutil/imgutils.h"
61 #include "libavutil/intreadwrite.h"
62 #include "libavutil/opt.h"
68 /** Timeout parameter passed to DtsProcOutput() in us */
69 #define OUTPUT_PROC_TIMEOUT 50
70 /** Step between fake timestamps passed to hardware in units of 100ns */
71 #define TIMESTAMP_UNIT 100000
74 /*****************************************************************************
76 ****************************************************************************/
84 typedef struct OpaqueList {
85 struct OpaqueList *next;
86 uint64_t fake_timestamp;
87 uint64_t reordered_opaque;
92 AVCodecContext *avctx;
96 uint8_t need_second_field;
106 static const AVOption options[] = {
107 { "crystalhd_downscale_width",
108 "Turn on downscaling to the specified width",
109 offsetof(CHDContext, sWidth),
110 AV_OPT_TYPE_INT, {.i64 = 0}, 0, UINT32_MAX,
111 AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM, },
116 /*****************************************************************************
118 ****************************************************************************/
120 static inline BC_MEDIA_SUBTYPE id2subtype(CHDContext *priv, enum AVCodecID id)
123 case AV_CODEC_ID_MPEG4:
124 return BC_MSUBTYPE_DIVX;
125 case AV_CODEC_ID_MSMPEG4V3:
126 return BC_MSUBTYPE_DIVX311;
127 case AV_CODEC_ID_MPEG2VIDEO:
128 return BC_MSUBTYPE_MPEG2VIDEO;
129 case AV_CODEC_ID_VC1:
130 return BC_MSUBTYPE_VC1;
131 case AV_CODEC_ID_WMV3:
132 return BC_MSUBTYPE_WMV3;
133 case AV_CODEC_ID_H264:
134 return BC_MSUBTYPE_H264;
136 return BC_MSUBTYPE_INVALID;
140 static inline void print_frame_info(CHDContext *priv, BC_DTS_PROC_OUT *output)
142 av_log(priv->avctx, AV_LOG_TRACE, "\tYBuffSz: %u\n", output->YbuffSz);
143 av_log(priv->avctx, AV_LOG_TRACE, "\tYBuffDoneSz: %u\n",
144 output->YBuffDoneSz);
145 av_log(priv->avctx, AV_LOG_TRACE, "\tUVBuffDoneSz: %u\n",
146 output->UVBuffDoneSz);
147 av_log(priv->avctx, AV_LOG_TRACE, "\tTimestamp: %"PRIu64"\n",
148 output->PicInfo.timeStamp);
149 av_log(priv->avctx, AV_LOG_TRACE, "\tPicture Number: %u\n",
150 output->PicInfo.picture_number);
151 av_log(priv->avctx, AV_LOG_TRACE, "\tWidth: %u\n",
152 output->PicInfo.width);
153 av_log(priv->avctx, AV_LOG_TRACE, "\tHeight: %u\n",
154 output->PicInfo.height);
155 av_log(priv->avctx, AV_LOG_TRACE, "\tChroma: 0x%03x\n",
156 output->PicInfo.chroma_format);
157 av_log(priv->avctx, AV_LOG_TRACE, "\tPulldown: %u\n",
158 output->PicInfo.pulldown);
159 av_log(priv->avctx, AV_LOG_TRACE, "\tFlags: 0x%08x\n",
160 output->PicInfo.flags);
161 av_log(priv->avctx, AV_LOG_TRACE, "\tFrame Rate/Res: %u\n",
162 output->PicInfo.frame_rate);
163 av_log(priv->avctx, AV_LOG_TRACE, "\tAspect Ratio: %u\n",
164 output->PicInfo.aspect_ratio);
165 av_log(priv->avctx, AV_LOG_TRACE, "\tColor Primaries: %u\n",
166 output->PicInfo.colour_primaries);
167 av_log(priv->avctx, AV_LOG_TRACE, "\tMetaData: %u\n",
168 output->PicInfo.picture_meta_payload);
169 av_log(priv->avctx, AV_LOG_TRACE, "\tSession Number: %u\n",
170 output->PicInfo.sess_num);
171 av_log(priv->avctx, AV_LOG_TRACE, "\tycom: %u\n",
172 output->PicInfo.ycom);
173 av_log(priv->avctx, AV_LOG_TRACE, "\tCustom Aspect: %u\n",
174 output->PicInfo.custom_aspect_ratio_width_height);
175 av_log(priv->avctx, AV_LOG_TRACE, "\tFrames to Drop: %u\n",
176 output->PicInfo.n_drop);
177 av_log(priv->avctx, AV_LOG_TRACE, "\tH264 Valid Fields: 0x%08x\n",
178 output->PicInfo.other.h264.valid);
182 /*****************************************************************************
183 * OpaqueList functions
184 ****************************************************************************/
186 static uint64_t opaque_list_push(CHDContext *priv, uint64_t reordered_opaque)
188 OpaqueList *newNode = av_mallocz(sizeof (OpaqueList));
190 av_log(priv->avctx, AV_LOG_ERROR,
191 "Unable to allocate new node in OpaqueList.\n");
195 newNode->fake_timestamp = TIMESTAMP_UNIT;
196 priv->head = newNode;
198 newNode->fake_timestamp = priv->tail->fake_timestamp + TIMESTAMP_UNIT;
199 priv->tail->next = newNode;
201 priv->tail = newNode;
202 newNode->reordered_opaque = reordered_opaque;
204 return newNode->fake_timestamp;
208 * The OpaqueList is built in decode order, while elements will be removed
209 * in presentation order. If frames are reordered, this means we must be
210 * able to remove elements that are not the first element.
212 * Returned node must be freed by caller.
214 static OpaqueList *opaque_list_pop(CHDContext *priv, uint64_t fake_timestamp)
216 OpaqueList *node = priv->head;
219 av_log(priv->avctx, AV_LOG_ERROR,
220 "CrystalHD: Attempted to query non-existent timestamps.\n");
225 * The first element is special-cased because we have to manipulate
226 * the head pointer rather than the previous element in the list.
228 if (priv->head->fake_timestamp == fake_timestamp) {
229 priv->head = node->next;
231 if (!priv->head->next)
232 priv->tail = priv->head;
239 * The list is processed at arm's length so that we have the
240 * previous element available to rewrite its next pointer.
243 OpaqueList *current = node->next;
244 if (current->fake_timestamp == fake_timestamp) {
245 node->next = current->next;
250 current->next = NULL;
257 av_log(priv->avctx, AV_LOG_VERBOSE,
258 "CrystalHD: Couldn't match fake_timestamp.\n");
263 /*****************************************************************************
264 * Video decoder API function definitions
265 ****************************************************************************/
267 static void flush(AVCodecContext *avctx)
269 CHDContext *priv = avctx->priv_data;
271 priv->need_second_field = 0;
274 /* Flush mode 4 flushes all software and hardware buffers. */
275 DtsFlushInput(priv->dev, 4);
279 static av_cold int uninit(AVCodecContext *avctx)
281 CHDContext *priv = avctx->priv_data;
285 DtsStopDecoder(device);
286 DtsCloseDecoder(device);
287 DtsDeviceClose(device);
290 OpaqueList *node = priv->head;
292 OpaqueList *next = node->next;
301 static av_cold int init(AVCodecContext *avctx)
305 BC_INFO_CRYSTAL version;
306 BC_INPUT_FORMAT format = {
309 .OptFlags = 0x80000000 | vdecFrameRate59_94 | 0x40,
310 .width = avctx->width,
311 .height = avctx->height,
314 BC_MEDIA_SUBTYPE subtype;
316 uint32_t mode = DTS_PLAYBACK_MODE |
317 DTS_LOAD_FILE_PLAY_FW |
318 DTS_SKIP_TX_CHK_CPB |
319 DTS_PLAYBACK_DROP_RPT_MODE |
320 DTS_SINGLE_THREADED_MODE |
321 DTS_DFLT_RESOLUTION(vdecRESOLUTION_1080p23_976);
323 av_log(avctx, AV_LOG_VERBOSE, "CrystalHD Init for %s\n",
326 avctx->pix_fmt = AV_PIX_FMT_YUYV422;
328 /* Initialize the library */
329 priv = avctx->priv_data;
333 subtype = id2subtype(priv, avctx->codec->id);
335 case BC_MSUBTYPE_H264:
336 format.startCodeSz = 4;
338 case BC_MSUBTYPE_VC1:
339 case BC_MSUBTYPE_WVC1:
340 case BC_MSUBTYPE_WMV3:
341 case BC_MSUBTYPE_WMVA:
342 case BC_MSUBTYPE_MPEG2VIDEO:
343 case BC_MSUBTYPE_DIVX:
344 case BC_MSUBTYPE_DIVX311:
345 format.pMetaData = avctx->extradata;
346 format.metaDataSz = avctx->extradata_size;
349 av_log(avctx, AV_LOG_ERROR, "CrystalHD: Unknown codec name\n");
350 return AVERROR(EINVAL);
352 format.mSubtype = subtype;
355 format.bEnableScaling = 1;
356 format.ScalingParams.sWidth = priv->sWidth;
359 /* Get a decoder instance */
360 av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: starting up\n");
361 // Initialize the Link and Decoder devices
362 ret = DtsDeviceOpen(&priv->dev, mode);
363 if (ret != BC_STS_SUCCESS) {
364 av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: DtsDeviceOpen failed\n");
368 ret = DtsCrystalHDVersion(priv->dev, &version);
369 if (ret != BC_STS_SUCCESS) {
370 av_log(avctx, AV_LOG_VERBOSE,
371 "CrystalHD: DtsCrystalHDVersion failed\n");
374 priv->is_70012 = version.device == 0;
376 if (priv->is_70012 &&
377 (subtype == BC_MSUBTYPE_DIVX || subtype == BC_MSUBTYPE_DIVX311)) {
378 av_log(avctx, AV_LOG_VERBOSE,
379 "CrystalHD: BCM70012 doesn't support MPEG4-ASP/DivX/Xvid\n");
383 ret = DtsSetInputFormat(priv->dev, &format);
384 if (ret != BC_STS_SUCCESS) {
385 av_log(avctx, AV_LOG_ERROR, "CrystalHD: SetInputFormat failed\n");
389 ret = DtsOpenDecoder(priv->dev, BC_STREAM_TYPE_ES);
390 if (ret != BC_STS_SUCCESS) {
391 av_log(avctx, AV_LOG_ERROR, "CrystalHD: DtsOpenDecoder failed\n");
395 ret = DtsSetColorSpace(priv->dev, OUTPUT_MODE422_YUY2);
396 if (ret != BC_STS_SUCCESS) {
397 av_log(avctx, AV_LOG_ERROR, "CrystalHD: DtsSetColorSpace failed\n");
400 ret = DtsStartDecoder(priv->dev);
401 if (ret != BC_STS_SUCCESS) {
402 av_log(avctx, AV_LOG_ERROR, "CrystalHD: DtsStartDecoder failed\n");
405 ret = DtsStartCapture(priv->dev);
406 if (ret != BC_STS_SUCCESS) {
407 av_log(avctx, AV_LOG_ERROR, "CrystalHD: DtsStartCapture failed\n");
411 av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Init complete.\n");
421 static inline CopyRet copy_frame(AVCodecContext *avctx,
422 BC_DTS_PROC_OUT *output,
423 AVFrame *frame, int *got_frame)
426 BC_DTS_STATUS decoder_status = { 0, };
429 CHDContext *priv = avctx->priv_data;
430 int64_t pkt_pts = AV_NOPTS_VALUE;
432 uint8_t bottom_field = (output->PicInfo.flags & VDEC_FLAG_BOTTOMFIELD) ==
433 VDEC_FLAG_BOTTOMFIELD;
434 uint8_t bottom_first = !!(output->PicInfo.flags & VDEC_FLAG_BOTTOM_FIRST);
436 int width = output->PicInfo.width;
437 int height = output->PicInfo.height;
439 uint8_t *src = output->Ybuff;
444 if (output->PicInfo.timeStamp != 0) {
445 OpaqueList *node = opaque_list_pop(priv, output->PicInfo.timeStamp);
447 pkt_pts = node->reordered_opaque;
451 * We will encounter a situation where a timestamp cannot be
452 * popped if a second field is being returned. In this case,
453 * each field has the same timestamp and the first one will
454 * cause it to be popped. We'll avoid overwriting the valid
458 av_log(avctx, AV_LOG_VERBOSE, "output \"pts\": %"PRIu64"\n",
459 output->PicInfo.timeStamp);
462 ret = DtsGetDriverStatus(priv->dev, &decoder_status);
463 if (ret != BC_STS_SUCCESS) {
464 av_log(avctx, AV_LOG_ERROR,
465 "CrystalHD: GetDriverStatus failed: %u\n", ret);
469 interlaced = output->PicInfo.flags & VDEC_FLAG_INTERLACED_SRC;
471 av_log(avctx, AV_LOG_VERBOSE, "Interlaced state: %d\n",
474 priv->need_second_field = interlaced && !priv->need_second_field;
476 if (!frame->data[0]) {
477 if (ff_get_buffer(avctx, frame, 0) < 0)
481 bwidth = av_image_get_linesize(avctx->pix_fmt, width, 0);
485 if (priv->is_70012) {
490 else if (width <= 1280)
493 sStride = av_image_get_linesize(avctx->pix_fmt, pStride, 0);
500 dStride = frame->linesize[0];
501 dst = frame->data[0];
503 av_log(priv->avctx, AV_LOG_VERBOSE, "CrystalHD: Copying out frame\n");
506 * The hardware doesn't return the first sample of a picture.
507 * Ignoring why it behaves this way, it's better to copy the sample from
508 * the second line, rather than the next sample across because the chroma
509 * values should be correct (assuming the decoded video was 4:2:0, which
512 *((uint32_t *)src) = *((uint32_t *)(src + sStride));
520 av_log(priv->avctx, AV_LOG_VERBOSE, "Interlaced: bottom field\n");
523 av_log(priv->avctx, AV_LOG_VERBOSE, "Interlaced: top field\n");
527 for (sY = 0; sY < height; dY++, sY++) {
528 memcpy(&(dst[dY * dStride]), &(src[sY * sStride]), bwidth);
532 av_image_copy_plane(dst, dStride, src, sStride, bwidth, height);
535 frame->interlaced_frame = interlaced;
537 frame->top_field_first = !bottom_first;
539 frame->pts = pkt_pts;
541 FF_DISABLE_DEPRECATION_WARNINGS
542 frame->pkt_pts = pkt_pts;
543 FF_ENABLE_DEPRECATION_WARNINGS
547 frame->pkt_duration = 0;
548 frame->pkt_size = -1;
550 if (!priv->need_second_field) {
553 return RET_COPY_AGAIN;
560 static inline CopyRet receive_frame(AVCodecContext *avctx,
561 AVFrame *frame, int *got_frame)
564 BC_DTS_PROC_OUT output = {
565 .PicInfo.width = avctx->width,
566 .PicInfo.height = avctx->height,
568 CHDContext *priv = avctx->priv_data;
569 HANDLE dev = priv->dev;
573 // Request decoded data from the driver
574 ret = DtsProcOutputNoCopy(dev, OUTPUT_PROC_TIMEOUT, &output);
575 if (ret == BC_STS_FMT_CHANGE) {
576 av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Initial format change\n");
577 avctx->width = output.PicInfo.width;
578 avctx->height = output.PicInfo.height;
579 switch ( output.PicInfo.aspect_ratio ) {
580 case vdecAspectRatioSquare:
581 avctx->sample_aspect_ratio = (AVRational) { 1, 1};
583 case vdecAspectRatio12_11:
584 avctx->sample_aspect_ratio = (AVRational) { 12, 11};
586 case vdecAspectRatio10_11:
587 avctx->sample_aspect_ratio = (AVRational) { 10, 11};
589 case vdecAspectRatio16_11:
590 avctx->sample_aspect_ratio = (AVRational) { 16, 11};
592 case vdecAspectRatio40_33:
593 avctx->sample_aspect_ratio = (AVRational) { 40, 33};
595 case vdecAspectRatio24_11:
596 avctx->sample_aspect_ratio = (AVRational) { 24, 11};
598 case vdecAspectRatio20_11:
599 avctx->sample_aspect_ratio = (AVRational) { 20, 11};
601 case vdecAspectRatio32_11:
602 avctx->sample_aspect_ratio = (AVRational) { 32, 11};
604 case vdecAspectRatio80_33:
605 avctx->sample_aspect_ratio = (AVRational) { 80, 33};
607 case vdecAspectRatio18_11:
608 avctx->sample_aspect_ratio = (AVRational) { 18, 11};
610 case vdecAspectRatio15_11:
611 avctx->sample_aspect_ratio = (AVRational) { 15, 11};
613 case vdecAspectRatio64_33:
614 avctx->sample_aspect_ratio = (AVRational) { 64, 33};
616 case vdecAspectRatio160_99:
617 avctx->sample_aspect_ratio = (AVRational) {160, 99};
619 case vdecAspectRatio4_3:
620 avctx->sample_aspect_ratio = (AVRational) { 4, 3};
622 case vdecAspectRatio16_9:
623 avctx->sample_aspect_ratio = (AVRational) { 16, 9};
625 case vdecAspectRatio221_1:
626 avctx->sample_aspect_ratio = (AVRational) {221, 1};
629 return RET_COPY_AGAIN;
630 } else if (ret == BC_STS_SUCCESS) {
632 if (output.PoutFlags & BC_POUT_FLAGS_PIB_VALID) {
633 print_frame_info(priv, &output);
635 copy_ret = copy_frame(avctx, &output, frame, got_frame);
638 * An invalid frame has been consumed.
640 av_log(avctx, AV_LOG_ERROR, "CrystalHD: ProcOutput succeeded with "
642 copy_ret = RET_COPY_AGAIN;
644 DtsReleaseOutputBuffs(dev, NULL, FALSE);
647 } else if (ret == BC_STS_BUSY) {
648 return RET_COPY_AGAIN;
650 av_log(avctx, AV_LOG_ERROR, "CrystalHD: ProcOutput failed %d\n", ret);
655 static int crystalhd_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt)
658 CHDContext *priv = avctx->priv_data;
659 HANDLE dev = priv->dev;
660 AVPacket filtered_packet = { 0 };
663 av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: decode_packet\n");
665 if (avpkt && avpkt->size) {
669 * Despite being notionally opaque, either libcrystalhd or
670 * the hardware itself will mangle pts values that are too
671 * small or too large. The docs claim it should be in units
672 * of 100ns. Given that we're nominally dealing with a black
673 * box on both sides, any transform we do has no guarantee of
674 * avoiding mangling so we need to build a mapping to values
675 * we know will not be mangled.
677 pts = opaque_list_push(priv, avpkt->pts);
679 ret = AVERROR(ENOMEM);
682 av_log(priv->avctx, AV_LOG_VERBOSE,
683 "input \"pts\": %"PRIu64"\n", pts);
684 bc_ret = DtsProcInput(dev, avpkt->data, avpkt->size, pts, 0);
685 if (bc_ret == BC_STS_BUSY) {
686 av_log(avctx, AV_LOG_WARNING,
687 "CrystalHD: ProcInput returned busy\n");
688 ret = AVERROR(EAGAIN);
690 } else if (bc_ret != BC_STS_SUCCESS) {
691 av_log(avctx, AV_LOG_ERROR,
692 "CrystalHD: ProcInput failed: %u\n", ret);
697 av_log(avctx, AV_LOG_INFO, "CrystalHD: No more input data\n");
703 av_packet_unref(&filtered_packet);
707 static int crystalhd_receive_frame(AVCodecContext *avctx, AVFrame *frame)
710 BC_DTS_STATUS decoder_status = { 0, };
712 CHDContext *priv = avctx->priv_data;
713 HANDLE dev = priv->dev;
718 av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: receive_frame\n");
720 ret = ff_decode_get_packet(avctx, &pkt);
721 if (ret < 0 && ret != AVERROR_EOF) {
725 while (pkt.size > DtsTxFreeSize(dev)) {
727 * Block until there is space in the buffer for the next packet.
728 * We assume that the hardware will make forward progress at this
729 * point, although in pathological cases that may not happen.
731 av_log(avctx, AV_LOG_TRACE, "CrystalHD: Waiting for space in input buffer\n");
734 ret = crystalhd_decode_packet(avctx, &pkt);
735 av_packet_unref(&pkt);
736 // crystalhd_is_buffer_full() should avoid this.
737 if (ret == AVERROR(EAGAIN)) {
738 ret = AVERROR_EXTERNAL;
740 if (ret < 0 && ret != AVERROR_EOF) {
745 bc_ret = DtsGetDriverStatus(dev, &decoder_status);
746 if (bc_ret != BC_STS_SUCCESS) {
747 av_log(avctx, AV_LOG_ERROR, "CrystalHD: GetDriverStatus failed\n");
751 if (decoder_status.ReadyListCount == 0) {
752 av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Insufficient frames ready. Returning\n");
758 rec_ret = receive_frame(avctx, frame, &got_frame);
759 } while (rec_ret == RET_COPY_AGAIN);
761 if (rec_ret == RET_ERROR) {
763 } else if (got_frame == 0) {
764 return priv->draining ? AVERROR_EOF : AVERROR(EAGAIN);
770 #define DEFINE_CRYSTALHD_DECODER(x, X, bsf_name) \
771 static const AVClass x##_crystalhd_class = { \
772 .class_name = #x "_crystalhd", \
773 .item_name = av_default_item_name, \
775 .version = LIBAVUTIL_VERSION_INT, \
777 AVCodec ff_##x##_crystalhd_decoder = { \
778 .name = #x "_crystalhd", \
779 .long_name = NULL_IF_CONFIG_SMALL("CrystalHD " #X " decoder"), \
780 .type = AVMEDIA_TYPE_VIDEO, \
781 .id = AV_CODEC_ID_##X, \
782 .priv_data_size = sizeof(CHDContext), \
783 .priv_class = &x##_crystalhd_class, \
786 .receive_frame = crystalhd_receive_frame, \
789 .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \
790 .pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUYV422, AV_PIX_FMT_NONE}, \
793 #if CONFIG_H264_CRYSTALHD_DECODER
794 DEFINE_CRYSTALHD_DECODER(h264, H264, "h264_mp4toannexb")
797 #if CONFIG_MPEG2_CRYSTALHD_DECODER
798 DEFINE_CRYSTALHD_DECODER(mpeg2, MPEG2VIDEO, NULL)
801 #if CONFIG_MPEG4_CRYSTALHD_DECODER
802 DEFINE_CRYSTALHD_DECODER(mpeg4, MPEG4, "mpeg4_unpack_bframes")
805 #if CONFIG_MSMPEG4_CRYSTALHD_DECODER
806 DEFINE_CRYSTALHD_DECODER(msmpeg4, MSMPEG4V3, NULL)
809 #if CONFIG_VC1_CRYSTALHD_DECODER
810 DEFINE_CRYSTALHD_DECODER(vc1, VC1, NULL)
813 #if CONFIG_WMV3_CRYSTALHD_DECODER
814 DEFINE_CRYSTALHD_DECODER(wmv3, WMV3, NULL)