@@ -174,6 +174,40 @@ static void encode_gbrp12(AVCodecContext *avctx, const AVFrame *pic, uint8_t *ds
}
}
+static int get_dpx_pri(int color_pri)
+{
+ switch (color_pri) {
+ case AVCOL_PRI_BT709:
+ return 6;
+ case AVCOL_PRI_SMPTE240M:
+ case AVCOL_PRI_SMPTE170M:
+ return 9;
+ case AVCOL_PRI_BT470BG:
+ return 10;
+ default:
+ return 0;
+ }
+}
+
+static int get_dpx_trc(int color_trc)
+{
+ switch (color_trc) {
+ case AVCOL_TRC_LINEAR:
+ return 2;
+ case AVCOL_TRC_BT709:
+ return 6;
+ case AVCOL_TRC_SMPTE240M:
+ case AVCOL_TRC_SMPTE170M:
+ return 9;
+ case AVCOL_TRC_GAMMA22:
+ return 8;
+ case AVCOL_TRC_GAMMA28:
+ return 7;
+ default:
+ return 0;
+ }
+}
+
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *frame, int *got_packet)
{
@@ -219,8 +253,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
write32(buf + 772, avctx->width);
write32(buf + 776, avctx->height);
buf[800] = s->descriptor;
- buf[801] = 2; /* linear transfer */
- buf[802] = 2; /* linear colorimetric */
+ buf[801] = get_dpx_trc(avctx->color_trc);
+ buf[802] = get_dpx_pri(avctx->color_primaries);
buf[803] = s->bits_per_component;
write16(buf + 804, (s->bits_per_component == 10 || s->bits_per_component == 12) ?
1 : 0); /* packing method */
@@ -1,3 +1,3 @@
-4c8880d5835ffb5fe37c1ed8c8d404de *tests/data/images/dpx/02.dpx
+233e219cbfa61e0b77f8e4fad05b2404 *tests/data/images/dpx/02.dpx
tests/data/images/dpx/%02d.dpx CRC=0x6da01946
305792 tests/data/images/dpx/02.dpx
@@ -1,3 +1,3 @@
-7ca935d5d5e00c54acbc85565d3039b6 *tests/data/images/gbrp10le.dpx/02.gbrp10le.dpx
+69b9da05fa73a4495ea04ce5f45b51d6 *tests/data/images/gbrp10le.dpx/02.gbrp10le.dpx
tests/data/images/gbrp10le.dpx/%02d.gbrp10le.dpx CRC=0xe6663fba
407168 tests/data/images/gbrp10le.dpx/02.gbrp10le.dpx
@@ -1,3 +1,3 @@
-a4cfea1797c928f2eff73573e559675d *tests/data/images/gbrp12le.dpx/02.gbrp12le.dpx
+056a0852dcd8e4d8727114df4a247dd4 *tests/data/images/gbrp12le.dpx/02.gbrp12le.dpx
tests/data/images/gbrp12le.dpx/%02d.gbrp12le.dpx CRC=0x1c755633
609920 tests/data/images/gbrp12le.dpx/02.gbrp12le.dpx
@@ -1,3 +1,3 @@
-075963c3c08978b6a20555ba09161434 *tests/data/images/rgb48le.dpx/02.rgb48le.dpx
+6e7d757279eaa914a92be107f8f01077 *tests/data/images/rgb48le.dpx/02.rgb48le.dpx
tests/data/images/rgb48le.dpx/%02d.rgb48le.dpx CRC=0xe5b9c023
609920 tests/data/images/rgb48le.dpx/02.rgb48le.dpx
@@ -1,3 +1,3 @@
-b9f22728f8ff393bf30cf6cbd624fa95 *tests/data/images/rgb48le_10.dpx/02.rgb48le_10.dpx
+097c4ff8138d76bffa51c1e8c36ea90f *tests/data/images/rgb48le_10.dpx/02.rgb48le_10.dpx
tests/data/images/rgb48le_10.dpx/%02d.rgb48le_10.dpx CRC=0xf38d5830
407168 tests/data/images/rgb48le_10.dpx/02.rgb48le_10.dpx
@@ -1,3 +1,3 @@
-545603630f30dec2768c8ae8d12eb8ea *tests/data/images/rgba64le.dpx/02.rgba64le.dpx
+51ccad3d05c1cef9db958adf01c9b55f *tests/data/images/rgba64le.dpx/02.rgba64le.dpx
tests/data/images/rgba64le.dpx/%02d.rgba64le.dpx CRC=0xe72ce131
812672 tests/data/images/rgba64le.dpx/02.rgba64le.dpx