[06/13] rtpdec_jpeg: Clarify where the subsampling magic numbers come from

Message ID 1347363979-4676-6-git-send-email-martin@martin.st
State Committed
Commit 31adff08a14b7cd3f4097a4f912108cd64472069
Headers show

Commit Message

Martin Storsjö Sept. 11, 2012, 11:46 a.m.
Write out the numbers the way they are constructed, not just the
final values.
---
 libavformat/rtpdec_jpeg.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Luca Barbato Sept. 11, 2012, 2:30 p.m. | #1
On 9/11/12 1:46 PM, Martin Storsjö wrote:
> Write out the numbers the way they are constructed, not just the
> final values.
> ---
>   libavformat/rtpdec_jpeg.c |    6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)

Ok.

Patch

diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c
index 4d8523d..20bb356 100644
--- a/libavformat/rtpdec_jpeg.c
+++ b/libavformat/rtpdec_jpeg.c
@@ -166,13 +166,13 @@  static int jpeg_create_header(uint8_t *buf, int size, uint32_t type, uint32_t w,
     bytestream2_put_be16(&pbc, w);
     bytestream2_put_byte(&pbc, 3);
     bytestream2_put_byte(&pbc, 1);
-    bytestream2_put_byte(&pbc, type ? 34 : 33);
+    bytestream2_put_byte(&pbc, (2 << 4) | (type ? 2 : 1)); /* hsample/vsample */
     bytestream2_put_byte(&pbc, 0);
     bytestream2_put_byte(&pbc, 2);
-    bytestream2_put_byte(&pbc, 17);
+    bytestream2_put_byte(&pbc, 1 << 4 | 1); /* hsample/vsample */
     bytestream2_put_byte(&pbc, nb_qtable == 2 ? 1 : 0);
     bytestream2_put_byte(&pbc, 3);
-    bytestream2_put_byte(&pbc, 17);
+    bytestream2_put_byte(&pbc, 1 << 4 | 1); /* hsample/vsample */
     bytestream2_put_byte(&pbc, nb_qtable == 2 ? 1 : 0);
 
     /* SOS */