`Page 1/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`1
`+++++¬
`…
`¬2
`$Id: rgbalterencoding.c,v 1.8 2001/10/02 21:15:02 guyc Exp $¬
`3
`¬4
`Copyright (c) 2001 BeComm Corporation¬
`5
`¬6
`Filename:¬
`7
`¬8
` rgbalterencoding.c¬
`9
`¬10
`Abstract:¬
`11
`¬12
` Transforms the image's pixels from their current encoding to a new
`13
`one. This¬
`…
` is useful for compressing an image and altering the pixel format¬
`14
` for the end display device.¬
`15
`¬16
` A new encoding is specified as a path attribute with the name¬
`17
` "newencoding". It should be a 32 Integer.¬
`18
`¬19
`Owner:¬
`20
`¬21
` Andy Kutner (andyk)¬
`22
`¬23
`--------------------------------------------------------------------------
`24
`---*/¬
`…
`¬25
`#define SOS_DEBUG_ZONE "/beads/rgbalterencoding"¬
`26
`#include <sosstrings.h>¬
`27
`#include <sosmultimedia.h>¬
`28
`¬29
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`30
`+++++¬
`…
`MACROS¬
`31
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`32
`+++*/¬
`…
`#define RED_SIZE(A) ((A) & 0xFF)¬
`33
`#define GREEN_SIZE(A) (((A) & 0xFF00) >> (SOS_BITSPERBYTE))¬
`34
`#define BLUE_SIZE(A) (((A) & 0xFF0000) >> (2 * SOS_BITSPERBYTE))¬
`35
`#define TOTAL_SIZE(A) (((A) & 0xFF000000) >> (3 * SOS_BITSPERBYTE))¬
`36
`#define BLANK_SIZE(A) (TOTAL_SIZE(A) - (RED_SIZE(A) + GREEN_SIZE(A) +
`37
`BLUE_SIZE(A)))¬
`…
`/* shift the total size right by 3 bytes. then shift it right by 3¬
`38
` bits which is the same as deviding by 8 or a Byte. */¬
`39
`
`Page 1 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001…/…/…/main/rgbalterencoding.c
`Page 2/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`#define TOTAL_SIZE_BYTES(A) (((A) & 0xFF000000) >> (3 * SOS_BITSPERBYTE +
`40
`3))¬
`…
`¬41
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`42
`+++++¬
`…
`Named Constants¬
`43
`--------------------------------------------------------------------------
`44
`---*/¬
`…
`¬45
`/* Name of bead */¬
`46
`static const char BEAD_NAME[] = "rgbalterencoding";¬
`47
`¬48
`static const char VIDEOCONTEXT_CLASS_NAME[] = "rgbcontext";¬
`49
`¬50
`static const char NEW_ENCODING[] = "newencoding";¬
`51
`¬52
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`53
`+++++¬
`…
`Structs¬
`54
`--------------------------------------------------------------------------
`55
`---*/¬
`…
`typedef struct _RGBALTERENCODING_CONTEXT {¬
`56
` SOS_IVIDEOCONTEXT * InVideoContext;¬
`57
` SOS_IVIDEOCONTEXT * OutVideoContext;¬
`58
` SOS_VIDEO_FORMAT OutFormat;¬
`59
` SOS_UINT32 OutBufferSize;¬
`60
` ¬
`61
` SOS_UINT32 RedMask;¬
`62
` SOS_UINT32 GreenMask;¬
`63
` SOS_UINT32 BlueMask;¬
`64
`¬65
` SOS_UINT32 RedRightShift;¬
`66
` SOS_UINT32 GreenRightShift;¬
`67
` SOS_UINT32 BlueRightShift;¬
`68
`¬69
` SOS_UINT32 RedLeftShift;¬
`70
` SOS_UINT32 GreenLeftShift;¬
`71
` SOS_UINT32 BlueLeftShift;¬
`72
`} RGBALTERENCODING_CONTEXT;¬
`73
`¬74
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`75
`+++++¬
`…
`Context Stuff¬
`76
`--------------------------------------------------------------------------
`77
`---*/¬
`…
`
`Page 2 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001…/…/…/main/rgbalterencoding.c
`Page 3/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`¬78
`static¬
`79
`void¬
`80
`RgbScale_ContextDestroy(¬
`81
` RGBALTERENCODING_CONTEXT * Context¬
`82
`)¬
`83
`{¬
`84
` if (Context) {¬
`85
` SOS_Interface_Release(Context->InVideoContext);¬
`86
` SOS_Interface_Release(Context->OutVideoContext);¬
`87
` SOS_Mem_Free(Context);¬
`88
` }¬
`89
`}¬
`90
`¬91
`static¬
`92
`RGBALTERENCODING_CONTEXT *¬
`93
`RgbScale_ContextCreate(¬
`94
` void¬
`95
`)¬
`96
`{¬
`97
` RGBALTERENCODING_CONTEXT *context;¬
`98
`¬99
` context = SOS_Mem_Alloc(sizeof(*context));¬
`100
` if (context) {¬
`101
` SOS_memset(context, 0, sizeof(*context));¬
`102
`¬
`103
` context->OutVideoContext = SOS_Interface_CreateFromClassName(¬
`104
` VIDEOCONTEXT_CLASS_NAME,¬
`105
` SOS_IVIDEOCONTEXT_ID¬
`106
` );¬
`107
`¬
`108
` SOS_ASSERT_ASSUMPTION(¬
`109
` context->OutVideoContext!=NULL,¬
`110
` "Couldn't create video context"¬
`111
` );¬
`112
`¬
`113
` if (!context->OutVideoContext){¬
`114
` SOS_Mem_Free(context);¬
`115
` context = NULL;¬
`116
` }¬
`117
` }¬
`118
` return context;¬
`119
`}¬
`120
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`121
`+++++¬
`…
`
`Page 3 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001…/…/…/main/rgbalterencoding.c
`Page 4/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`122
`123
`…
`124
`125
`126
`127
`128
`129
`130
`131
`132
`133
`134
`135
`136
`137
`138
`139
`140
`141
`142
`143
`144
`145
`146
`147
`148
`149
`150
`151
`152
`153
`154
`155
`156
`157
`158
`159
`160
`161
`162
`163
`164
`165
`
`Initialization¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`¬
`/*++¬
`Routine Name:¬
`¬
` GetInVideoContext¬
`¬
`Routine Description:¬
`¬
` Retrieve the video context for the incoming video stream.¬
`¬
`Parameters:¬
`¬
` RGBALTERENCODING_CONTEXT* Context - [in/out]¬
` A session context should already be allocated. This routine¬
` filles in the InVideoContext variable.¬
`¬
` SOS_PATH* Path - [in]¬
` The path this session will receive images on.¬
`¬
`Return Value:¬
`¬
` SOS_STATUS - ¬
` SOS_Success on success.¬
` Any other value means an error occured.¬
`¬
`--*/¬
`¬
`static¬
`SOS_STATUS¬
`GetInVideoContext(¬
` RGBALTERENCODING_CONTEXT* Context,¬
` SOS_PATH* Path¬
`)¬
`{¬
` SOS_STATUS status;¬
` SOS_REGOBJECT *contextObject;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("SetInVidoContext\n");¬
`¬
` status = SOS_Path_AttributeGet(¬
` Path,¬
`
`Page 4 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001…/…/…/main/rgbalterencoding.c
`Page 5/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`166
`167
`168
`169
`170
`…
`171
`172
`173
`174
`175
`176
`177
`178
`179
`180
`…
`181
`182
`183
`184
`185
`186
`187
`188
`189
`190
`191
`192
`193
`194
`195
`196
`197
`198
`199
`200
`201
`202
`203
`204
`205
`206
`207
`208
`
` SOS_VIDEOCONTEXT_NAME,¬
` &contextObject¬
` );¬
`¬
` SOS_ASSERT_SOFT_ERROR( SOS_SUCCEEDED(status), "Path context does not
`contain a video context");¬
`¬
` if (SOS_SUCCEEDED(status)) {¬
` ¬
` status = SOS_RegObject_InterfaceGet(¬
` contextObject,¬
` SOS_IVIDEOCONTEXT_ID,¬
` (void**)&(Context->InVideoContext)¬
` );¬
`¬
` SOS_ASSERT_SOFT_ERROR( SOS_SUCCEEDED(status), "Video context does
`not support required interface");¬
` SOS_RegObject_Release(contextObject);¬
` }¬
`¬
` return status;¬
`}¬
`¬
`/*++¬
`Routine Name:¬
`¬
` SetOutVideoContext¬
`¬
`Routine Description:¬
`¬
` Retrives the new encoding from the Path and then creates a set of¬
` mask's and shifts used to coerse the data from the input format to¬
` the output format.¬
`¬
`Parameters:¬
`¬
` RGBALTERENCODING_CONTEXT* Context - [in]¬
` The session context.¬
`¬
` SOS_PATH* Path - [in]¬
` The Path that we are receiving messages on.¬
`¬
` SOS_VIDEO_FORMAT* InFormat - [in]¬
` The Pixel format of the incoming data.¬
`¬
`
`Page 5 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001…/…/…/main/rgbalterencoding.c
`Page 6/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`209
`210
`211
`212
`213
`214
`215
`216
`217
`218
`219
`220
`221
`222
`223
`224
`225
`226
`227
`228
`229
`230
`231
`232
`233
`234
`235
`236
`237
`238
`239
`240
`241
`242
`243
`244
`245
`246
`247
`248
`249
`250
`251
`252
`253
`
`Return Value:¬
`¬
` SOS_STATUS - ¬
` SOS_SUCCESS on success.¬
` Any other value means an error occured.¬
`¬
`--*/¬
`static¬
`SOS_STATUS¬
`SetOutVideoContext(¬
` RGBALTERENCODING_CONTEXT* Context,¬
` SOS_PATH* Path,¬
` SOS_VIDEO_FORMAT* InFormat¬
`)¬
`{¬
` SOS_STATUS status;¬
` SOS_REGOBJECT * object;¬
` SOS_UINT32 encoding;¬
` SOS_UINT32 blueNumberOfBits;¬
` SOS_UINT32 redNumberOfBits;¬
` SOS_UINT32 greenNumberOfBits;¬
` SOS_UINT32 blankInSize, blankOutSize, extraShift;¬
` int inSize,outSize;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("SetOutVidoContext\n");¬
`¬
` /*¬
` * Extract new encoding from context¬
` */¬
` status = SOS_Path_AttributeGet(¬
` Path,¬
` NEW_ENCODING,¬
` &object¬
` );¬
` ¬
` if (SOS_SUCCEEDED(status)) {¬
` status = SOS_RegObject_Int32ValueGet(¬
` object,¬
` &encoding¬
` );¬
` ¬
` SOS_RegObject_Release(object);¬
` }¬
`¬
` SOS_ASSERT_ASSUMPTION(¬
`
`Page 6 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001…/…/…/main/rgbalterencoding.c
`Page 7/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`254
`…
`255
`…
`…
`256
`257
`258
`259
`260
`261
`262
`263
`264
`265
`266
`267
`268
`269
`270
`271
`272
`273
`274
`275
`276
`277
`278
`279
`280
`281
`282
`283
`284
`285
`286
`287
`288
`289
`290
`291
`292
`293
`294
`295
`
` TOTAL_SIZE(encoding) >= RED_SIZE(encoding) + GREEN_SIZE(encoding)
`+ BLUE_SIZE(encoding),¬
` "The new encoding value is invalid. Please check the number you
`entered and make sure that the total size of a pixel is greater then or
`equal to the sum of the elements\n"¬
` );¬
` ¬
` /*¬
` * Use the new encoding and old encoding to figure out the masks¬
` * and shifts nessacary to move from the old encoding to the new one¬
` */¬
` if (SOS_SUCCEEDED(status)){¬
`¬
` /*¬
` * calculate the blank area for both the input and output¬
` */¬
` blankInSize = BLANK_SIZE(InFormat->Encoding);¬
` blankOutSize = BLANK_SIZE(encoding);¬
`¬
` /*¬
` * Calculate the red mask and shift¬
` */¬
` Context->RedMask = 0;¬
` ¬
` if (RED_SIZE(InFormat->Encoding) <= RED_SIZE(encoding)) {¬
` redNumberOfBits = RED_SIZE(InFormat->Encoding);¬
` extraShift = 0;¬
` }¬
` else {¬
` redNumberOfBits = RED_SIZE(encoding);¬
` extraShift = RED_SIZE(InFormat->Encoding) - redNumberOfBits;¬
` }¬
`¬
` /* create a mask */¬
` Context->RedMask = (1<<redNumberOfBits) - 1;¬
` Context->RedMask = Context->RedMask << (blankInSize + extraShift);¬
` ¬
` /* create a shift */¬
` inSize = RED_SIZE(InFormat->Encoding) + blankInSize;¬
` outSize = RED_SIZE(encoding) + blankOutSize;¬
` ¬
` if (inSize <= outSize) {¬
` Context->RedRightShift = 0;¬
` Context->RedLeftShift = outSize - inSize;¬
` }¬
`
`Page 7 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001…/…/…/main/rgbalterencoding.c
`Page 8/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`296
`297
`298
`299
`300
`301
`302
`303
`304
`305
`306
`307
`308
`309
`310
`311
`…
`312
`313
`314
`315
`316
`…
`317
`318
`319
`…
`320
`…
`321
`322
`323
`324
`325
`326
`327
`328
`329
`330
`331
`332
`333
`334
`335
`336
`
` else {¬
` Context->RedRightShift = inSize - outSize;¬
` Context->RedLeftShift = 0;¬
` }¬
` ¬
` /*¬
` * Calculate the green mask and shift¬
` */¬
` Context->GreenMask = 0;¬
` ¬
` if ( GREEN_SIZE(InFormat->Encoding) <= GREEN_SIZE(encoding)) {¬
` greenNumberOfBits = GREEN_SIZE(InFormat->Encoding);¬
` }¬
` else {¬
` greenNumberOfBits = GREEN_SIZE(encoding);¬
` extraShift = extraShift + GREEN_SIZE(InFormat->Encoding) -
`greenNumberOfBits;¬
` }¬
`¬
` /* create a mask */¬
` Context->GreenMask = (1<<greenNumberOfBits) - 1;¬
` Context->GreenMask = Context->GreenMask << (redNumberOfBits +
`blankInSize + extraShift);¬
` ¬
` /* create a shift */¬
` inSize = GREEN_SIZE(InFormat->Encoding) +
`RED_SIZE(InFormat->Encoding) + blankInSize;¬
` outSize = GREEN_SIZE(encoding) + RED_SIZE(encoding) +
`blankOutSize;¬
` ¬
` if ( inSize <= outSize ){¬
` Context->GreenRightShift = 0;¬
` Context->GreenLeftShift = outSize - inSize;¬
` }¬
` else {¬
` Context->GreenRightShift = inSize - outSize;¬
` Context->GreenLeftShift = 0;¬
` }¬
` ¬
` /*¬
` * Calculate the blue mask and shift¬
` */¬
` Context->BlueMask = 0;¬
` ¬
` if (BLUE_SIZE(InFormat->Encoding) <= BLUE_SIZE(encoding)) {¬
`
`Page 8 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001…/…/…/main/rgbalterencoding.c
`Page 9/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`337
`338
`339
`340
`341
`…
`342
`343
`344
`345
`346
`…
`347
`348
`…
`…
`349
`…
`350
`351
`352
`353
`354
`355
`356
`357
`358
`359
`360
`361
`362
`363
`364
`…
`365
`366
`367
`368
`369
`370
`371
`372
`373
`374
`375
`
` blueNumberOfBits = BLUE_SIZE(InFormat->Encoding);¬
` }¬
` else {¬
` blueNumberOfBits = BLUE_SIZE(encoding);¬
` extraShift = extraShift + BLUE_SIZE(InFormat->Encoding) -
`blueNumberOfBits;¬
` }¬
`¬
` /* create a mask */¬
` Context->BlueMask = (1<<blueNumberOfBits) - 1;¬
` Context->BlueMask = Context->BlueMask << (greenNumberOfBits +
`redNumberOfBits + blankInSize + extraShift);¬
` ¬
` inSize = BLUE_SIZE(InFormat->Encoding) +
`GREEN_SIZE(InFormat->Encoding) + RED_SIZE(InFormat->Encoding) +
`blankInSize;¬
` outSize = BLUE_SIZE(encoding) + GREEN_SIZE(encoding) +
`RED_SIZE(encoding) + blankOutSize;¬
` ¬
` if (inSize <= outSize){¬
` Context->BlueRightShift = 0;¬
` Context->BlueLeftShift = outSize - inSize;¬
` }¬
` else {¬
` Context->BlueRightShift = inSize - outSize;¬
` Context->BlueLeftShift = 0;¬
` }¬
`¬
` /*¬
` * Calculate the size of the output buffer (we will round up¬
` * to the next byte in cases where the size is not byte alligned)¬
` */¬
` Context->OutBufferSize = ((InFormat->Width * InFormat->Height *
`TOTAL_SIZE(encoding)) + (SOS_BITSPERBYTE-1)) / SOS_BITSPERBYTE;¬
`¬
` Context->OutFormat = *InFormat;¬
`// Context->OutFormat.Width = InFormat->Width;¬
`// Context->OutFormat.Height = InFormat->Height;¬
` Context->OutFormat.Encoding = encoding;¬
`¬
` SOS_Debug_StringPrint(¬
` "Frame rate is %lu/%lu\n",¬
` Context->OutFormat.FrameRate,¬
` Context->OutFormat.FrameRateDivisor¬
` );¬
`
`Page 9 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/200…/…/…/main/rgbalterencoding.c
`Page 10/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`376
`377
`378
`379
`380
`381
`382
`383
`384
`385
`386
`387
`388
`389
`390
`391
`392
`393
`394
`…
`395
`396
`…
`397
`398
`399
`400
`401
`402
`403
`404
`405
`406
`407
`408
`409
`410
`411
`412
`413
`414
`415
`416
`417
`418
`
`¬
` status = Context->OutVideoContext->FormatSet(¬
` Context->OutVideoContext,¬
` &(Context->OutFormat));¬
` } ¬
` /*¬
` * Put output video context into path context¬
` */¬
` if (SOS_SUCCEEDED(status)) {¬
` status = SOS_Path_AttributeSet(¬
` Path,¬
` SOS_VIDEOCONTEXT_NAME,¬
` SOS_Interface_ObjectPeek(Context->OutVideoContext)¬
` );¬
` }¬
`¬
` return status;¬
`}¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Bead Definition¬
`--------------------------------------------------------------------------
`---*/¬
`static¬
`SOS_STATUS¬
`KeyCreate(¬
` SOS_PATH *Path,¬
` SOS_MESSAGE *Message¬
`)¬
`{¬
` static SOS_UINT32 s_UniqueId = 0;¬
` SOS_REGOBJECT* uniqueSessionKey;¬
` ¬
` uniqueSessionKey = SOS_UInt32_Create(s_UniqueId++);¬
` SOS_Path_SessionKeySet(Path, uniqueSessionKey);¬
` SOS_RegObject_Release(uniqueSessionKey);¬
`¬
` return SOS_Success;¬
`}¬
`¬
`¬
`static¬
`SOS_STATUS¬
`MessageHandler(¬
` SOS_PATH *Path,¬
`
`Page 10 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/200…/…/…/main/rgbalterencoding.c
`Page 11/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`419
`420
`421
`422
`423
`424
`425
`426
`427
`428
`429
`430
`431
`432
`433
`434
`435
`436
`437
`438
`439
`440
`441
`442
`443
`444
`445
`446
`447
`448
`449
`450
`451
`452
`453
`454
`455
`456
`457
`458
`459
`460
`461
`462
`463
`
` SOS_MESSAGE *Message¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
` RGBALTERENCODING_CONTEXT * context;¬
` SOS_VIDEO_FORMAT inFormat;¬
` SOS_MESSAGE_ITERATOR * iterator = NULL;¬
` SOS_UINT8 * outBuffer = NULL;¬
` SOS_VIDEO_TIMESTAMP timeStamp = 0;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("RgbScale_MessageHandler\n");¬
`¬
` SOS_Path_SessionContextPeek(Path, (void**)&context);¬
`¬
` /*¬
` * First pass through get video context¬
` */¬
` if (!context->InVideoContext) {¬
` GetInVideoContext(context, Path);¬
` if (!context->InVideoContext) {¬
` status = SOS_Error;¬
` }¬
` }¬
`¬
` /*¬
` * Unpack the message¬
` */¬
` if (SOS_SUCCEEDED(status)) {¬
` status = context->InVideoContext->Unpack(¬
` context->InVideoContext,¬
` Message,¬
` &inFormat,¬
` &timeStamp¬
` );¬
` }¬
`¬
` /*¬
` * First pass through init output video context.¬
` * This MUST happen after the input format has¬
` * been determined.¬
` */¬
` if (SOS_SUCCEEDED(status)) {¬
` if (0 == context->OutBufferSize) {¬
` status = SetOutVideoContext(context, Path, &inFormat);¬
` }¬
`
`Page 11 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/200…/…/…/main/rgbalterencoding.c
`Page 12/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`464
`465
`466
`467
`468
`469
`470
`471
`472
`473
`474
`475
`476
`477
`478
`479
`480
`481
`482
`483
`484
`485
`486
`487
`488
`489
`490
`491
`492
`…
`493
`…
`494
`495
`496
`497
`498
`499
`500
`501
`502
`503
`504
`505
`506
`
` }¬
`¬
` if (inFormat.Encoding != context->OutFormat.Encoding) {¬
` /* only process if there is something to be done */¬
` ¬
` if (SOS_SUCCEEDED(status)) {¬
` outBuffer = SOS_Mem_Alloc( context->OutBufferSize );¬
` if (!outBuffer) {¬
` status = SOS_Error;¬
` }¬
` }¬
` ¬
` if (SOS_SUCCEEDED(status)) {¬
` status = SOS_MessageIterator_Create(¬
` Message,¬
` &iterator¬
` );¬
` }¬
` ¬
` if (SOS_SUCCEEDED(status)) {¬
` ¬
` SOS_UINT32 h,w;¬
` SOS_UINT8 * inBuffer;¬
` SOS_UINT32 inValue;¬
` SOS_UINT32 outValue;¬
` int iteratorLength = 0;¬
` int inBufferIndex = 0;¬
` int outBufferIndex = 0;¬
` SOS_UINT32 inBytes =
`TOTAL_SIZE_BYTES(inFormat.Encoding);¬
` SOS_UINT32 outBytes =
`TOTAL_SIZE_BYTES(context->OutFormat.Encoding);¬
` ¬
` for (h = 0 ; h < inFormat.Height ; h++) { ¬
` for (w = 0 ; w < inFormat.Width ; w++) {¬
` ¬
` /*¬
` * get the input pixel¬
` */¬
` {¬
` SOS_UINT32 i;¬
` inValue = 0;¬
` for (i=0;i<inBytes;i++) {¬
` ¬
` if (inBufferIndex >= iteratorLength) {¬
`
`Page 12 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/200…/…/…/main/rgbalterencoding.c
`Page 13/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`507
`508
`509
`510
`511
`512
`513
`514
`515
`…
`…
`516
`517
`518
`519
`520
`521
`522
`523
`524
`525
`526
`527
`528
`529
`530
`531
`…
`532
`533
`534
`…
`535
`536
`537
`538
`539
`540
`541
`…
`542
`543
`544
`…
`545
`
` ¬
` status = SOS_MessageIterator_Next(¬
` iterator,¬
` (const void **)(&inBuffer),¬
` &iteratorLength);¬
` ¬
` SOS_ASSERT_ASSUMPTION(¬
` SOS_Success == status,¬
` "MessageIterator_Next Failed, this
`would only happen if a message does not contain all the data its header
`says it does.\n");¬
` ¬
` inBufferIndex = 0;¬
` }¬
` /* get the first value */¬
` inValue = inValue << SOS_BITSPERBYTE;¬
` inValue = inValue | inBuffer[inBufferIndex++];¬
` }¬
` }¬
` ¬
` /*¬
` * next apply a series of mask's and shift's to move¬
` * from the input format to output format¬
` */¬
` {¬
` if (context->BlueRightShift) {¬
` outValue = ((inValue & context->BlueMask) >>
`context->BlueRightShift);¬
` }¬
` else if (context->BlueLeftShift) {¬
` outValue = ((inValue & context->BlueMask) <<
`context->BlueLeftShift);¬
` }¬
` else {¬
` outValue = (inValue & context->BlueMask);¬
` }¬
` ¬
` if (context->GreenRightShift) {¬
` outValue = outValue | ((inValue &
`context->GreenMask) >> context->GreenRightShift);¬
` }¬
` else if (context->GreenLeftShift) {¬
` outValue = outValue | ((inValue &
`context->GreenMask) << context->GreenLeftShift);¬
` }¬
`
`Page 13 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/200…/…/…/main/rgbalterencoding.c
`Page 14/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`546
`547
`…
`548
`549
`550
`551
`…
`552
`553
`554
`…
`555
`556
`557
`…
`558
`559
`560
`561
`562
`563
`564
`565
`566
`567
`568
`…
`569
`570
`571
`…
`572
`573
`574
`575
`576
`577
`578
`579
`580
`581
`582
`583
`584
`
` else {¬
` outValue = outValue | (inValue &
`context->GreenMask);¬
` }¬
` ¬
` if (context->RedRightShift) {¬
` outValue = outValue | ((inValue &
`context->RedMask) >> context->RedRightShift);¬
` }¬
` else if (context->RedLeftShift) {¬
` outValue = outValue | ((inValue &
`context->RedMask) << context->RedLeftShift);¬
` }¬
` else {¬
` outValue = outValue | (inValue &
`context->RedMask);¬
` }¬
` }¬
` ¬
` /*¬
` * put the pixels into the output buffer¬
` */¬
` {¬
` int i;¬
` for (i=outBytes-1;i>=0;i--) {¬
` ¬
` outBuffer[outBufferIndex + i] =(SOS_UINT8)
`(outValue & 0xFF);¬
` outValue = outValue >> SOS_BITSPERBYTE;¬
` }¬
` outBufferIndex +=
`TOTAL_SIZE_BYTES(context->OutFormat.Encoding);¬
` }¬
` }¬
` }¬
` }¬
` /* clean up */¬
` SOS_MessageIterator_Destroy(iterator); ¬
` SOS_Message_Empty(Message);¬
` ¬
` /* put the new buffer into a message */¬
` if (SOS_SUCCEEDED(status)) {¬
` status = SOS_Message_HeadDataPush(¬
` Message,¬
` outBuffer,¬
`
`Page 14 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/200…/…/…/main/rgbalterencoding.c
`Page 15/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`585
`586
`587
`588
`589
`590
`591
`592
`593
`594
`595
`596
`597
`598
`599
`600
`601
`602
`603
`604
`605
`606
`607
`608
`609
`610
`611
`612
`613
`614
`615
`…
`616
`617
`…
`618
`619
`620
`621
`622
`623
`624
`625
`626
`627
`
` context->OutBufferSize,¬
` SOS_Mem_Free¬
` );¬
` }¬
`¬
` }¬
`¬
` if (SOS_SUCCEEDED(status)) {¬
` context->OutVideoContext->Pack(¬
` context->OutVideoContext,¬
` Message,¬
` NULL,¬
` timeStamp¬
` );¬
` }¬
` ¬
` if (SOS_SUCCEEDED(status)) {¬
` status = SOS_Path_MessageSend(¬
` Path,¬
` Message¬
` );¬
` }¬
` else {¬
` /* if an error occured clean up */¬
` SOS_Message_Destroy(Message);¬
` }¬
`¬
` return status;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Session Setup¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`static¬
`SOS_STATUS¬
`SessionInit(¬
` SOS_PATH *Path¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
` RGBALTERENCODING_CONTEXT *context = RgbScale_ContextCreate();¬
`¬
`
`Page 15 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/200…/…/…/main/rgbalterencoding.c
`Page 16/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`628
`629
`630
`631
`632
`633
`634
`635
`636
`637
`638
`639
`640
`641
`642
`643
`644
`645
`646
`647
`648
`649
`650
`651
`652
`653
`654
`655
`656
`…
`657
`658
`…
`659
`660
`661
`662
`663
`664
`665
`666
`667
`668
`669
`670
`
` SOS_DEBUGOUT_FUNC_TRACE( "Session Init called\n");¬
`¬
` if (context) {¬
` SOS_Path_SessionContextPut(Path, context);¬
` } else {¬
` status = SOS_Error;¬
` }¬
` ¬
` return status;¬
`}¬
`¬
`static¬
`SOS_STATUS¬
`SessionUninit(¬
` SOS_PATH *Path¬
`)¬
`{¬
` RGBALTERENCODING_CONTEXT *context;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE( "Session Uninit called\n");¬
`¬
` SOS_Path_SessionContextPeek(Path, (void**)&context);¬
`¬
` RgbScale_ContextDestroy(context);¬
`¬
` return SOS_Success;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Bead Setup¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`static¬
`SOS_STATUS¬
`BeadInit(¬
` SOS_BEAD *Bead,¬
` SOS_REGOBJECT *InitContext¬
`)¬
`{¬
` SOS_STATUS status;¬
` ¬
` /* register Decode Edge */¬
` status = SOS_Edge_Register(¬
`
`Page 16 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/200…/…/…/main/rgbalterencoding.c
`Page 17/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
`671
`672
`673
`674
`675
`676
`677
`678
`679
`680
`681
`682
`683
`684
`685
`686
`687
`688
`689
`690
`691
`692
`693
`694
`695
`696
`697
`698
`…
`699
`700
`…
`701
`702
`703
`704
`705
`706
`707
`708
`709
`710
`711
`712
`713
`
` Bead,¬
` "decode",¬
` NULL,¬
` NULL,¬
` NULL,¬
` KeyCreate,¬
` MessageHandler,¬
` NULL,¬
` NULL,¬
` NULL,¬
` NULL);¬
`¬
` if (SOS_FAILED(status)) {¬
` SOS_DEBUGOUT_MAJOR_EVENT( "Could not register decode edge");¬
` }¬
` return status;¬
`}¬
`¬
`static¬
`SOS_STATUS¬
`BeadUninit(¬
` void *BeadContext¬
`)¬
`{¬
` return SOS_Success;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Module Setup¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`SOS_STATUS¬
`SOS_ModuleInit (¬
` SOS_OBJECTFILE *ObjectFile,¬
` SOS_REGOBJECT *InitContext¬
`)¬
`{¬
` SOS_STATUS status;¬
` ¬
` SOS_DEBUGOUT_FUNC_TRACE( "SOS_ModuleInit called\n");¬
`¬
` /* register the Bead */¬
` status = SOS_Bead_Register(¬
`
`Page 17 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/200…/…/…/main/rgbalterencoding.c
`Page 18/18
`Saved: 10/2/01, 4:15:02 PM
`Printed for: Implicit
`
` ObjectFile,¬
` BEAD_NAME,¬
` NULL, /* Bead context */¬
` BeadInit,¬
` BeadUninit,¬
` SessionInit,¬
` SessionUninit¬
` );¬
`¬
` return status;¬
`}¬
`¬
`¬
`void¬
`SOS_ModuleUninit (¬
` SOS_OBJECTFILE *ObjectFile¬
`)¬
`{¬
` SOS_DEBUGOUT_FUNC_TRACE( "SOS_ModuleUninit called\n");¬
`}¬
`
`714
`715
`716
`717
`718
`719
`720
`721
`722
`723
`724
`725
`726
`727
`728
`729
`730
`731
`732
`733
`734
`
`Page 18 of 18
`
`Implicit Exhibit 2049
`Sonos v. Implicit, IPR2018-0766, -0767
`
`