]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dvdata.h
fix decoding of (broken) files with f_code=0
[ffmpeg] / libavcodec / dvdata.h
index 8d8f9da81d58e194d8b521bd9b3276791b4fcd11..acda751d6bf99e4ec794634b89aae9c057d13ecb 100644 (file)
@@ -37,6 +37,7 @@ typedef struct DVprofile {
     int              ltc_divisor;         /* FPS from the LTS standpoint */
     int              height;              /* picture height in pixels */
     int              width;               /* picture width in pixels */
+    AVRational       sar[2];              /* sample aspect ratios for 4:3 and 16:9 */
     const uint16_t  *video_place;         /* positions of all DV macro blocks */
     enum PixelFormat pix_fmt;             /* picture pixel format */
     
@@ -50,6 +51,11 @@ typedef struct DVprofile {
 
 #define NB_DV_VLC 409
 
+/* 
+ * There's a catch about the following three tables: the mapping they establish
+ * between (run, level) and vlc is not 1-1. So you have to watch out for that
+ * when building misc. tables. E.g. (1, 0) can be either 0x7cf or 0x1f82. 
+ */
 static const uint16_t dv_vlc_bits[409] = {
  0x0000, 0x0002, 0x0007, 0x0008, 0x0009, 0x0014, 0x0015, 0x0016,
  0x0017, 0x0030, 0x0031, 0x0032, 0x0033, 0x0068, 0x0069, 0x006a,
@@ -212,7 +218,7 @@ static const uint8_t dv_vlc_run[409] = {
   0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,
-  0,
+127,
 };
 
 static const uint8_t dv_vlc_level[409] = {
@@ -1293,6 +1299,7 @@ static const DVprofile dv_profiles[] = {
       .frame_rate_base = 1001,
       .height = 480,
       .width = 720,
+      .sar = {{10, 11}, {40, 33}},
       .video_place = dv_place_411,
       .pix_fmt = PIX_FMT_YUV411P,
       .audio_stride = 90,
@@ -1308,6 +1315,7 @@ static const DVprofile dv_profiles[] = {
       .ltc_divisor = 25,
       .height = 576,
       .width = 720,
+      .sar = {{59, 54}, {118, 81}},
       .video_place = dv_place_420,
       .pix_fmt = PIX_FMT_YUV420P,
       .audio_stride = 108,
@@ -1323,6 +1331,7 @@ static const DVprofile dv_profiles[] = {
       .ltc_divisor = 25,
       .height = 576,
       .width = 720,
+      .sar = {{59, 54}, {118, 81}},
       .video_place = dv_place_411P,
       .pix_fmt = PIX_FMT_YUV411P,
       .audio_stride = 108,