{"action":"created","comment":{"url":"https://api.github.com/repos/trstephen/elec483/pulls/comments/109080560","pull_request_review_id":30158670,"id":109080560,"diff_hunk":"@@ -41,40 +38,67 @@\n     'l', 'c', 'u', 'm', 'w', 'f', 'g', 'y', 'p', 'b', 'v', 'k', 'j', ...\n     'x', 'q', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'};\n \n-% Use a Matlab map container to map all the letter with a corresponding\n-% numerical value (26 letters, 10 numbers, 1 space).\n-letter_offsets = containers.Map(letter_freq, (0:length(letter_freq)-1));\n+% Create decimal values for each letter, where most frequent letters get \n+% the smallest values.\n+offsets = (0:length(letter_freq)-1);\n+\n+% Convert the decimal offsets to binary. Use base 6 since we have >32 values\n+binary_offsets = num2cell(dec2bin(offsets, word_size), 2)';\n+\n+% Map letters -> binary\n+letter_map = containers.Map(letter_freq, binary_offsets);\n \n % Convert the user inserted watermark phrase into lower case, then use the\n % map to convert it to a set of minimal offsets.\n wm = lower(wm);\n \n-offsets = zeros(size(wm));\n+% Convert the watermark phrase to a binary sequence\n+% TODO: Preallocate space to satisfy warning.\n+%       This is a bit tricky because I have to block-assign values\n+%       to wm_bin_seq, which I don't think is possible??\n+wm_bin_seq = [];\n for i = 1:length(wm)\n-    if letter_offsets.isKey(wm(i))\n-        offsets(i) = letter_offsets(wm(i));\n+    if letter_map.isKey(wm(i))\n+        % Append the binary value of the character to the sequence\n+        wm_bin_seq = [wm_bin_seq letter_map(wm(i))];\n     else\n-        offsets(i) = 0;\n+        % Append a ' ' if the character isn't in our map\n+        wm_bin_seq = [wm_bin_seq letter_map(' ')];\n     end\n end\n \n+% We have a 6x(num chars) matrix that needs to be converted into a 1x(6 x num chars) vector\n+wm_bin_seq = str2num(reshape(wm_bin_seq, 1, [])')';\n+\n+% Determine BCH correction code\n+% Have to pad up to valid (n,k) tuples for BCH codes\n+% See: https://www.mathworks.com/help/comm/ref/bchenc.html","path":"wm_encoder.m","position":90,"original_position":90,"commit_id":"a9fa72302e2ca0cad7193a4fe1a1e629e9e2fc9b","original_commit_id":"a9fa72302e2ca0cad7193a4fe1a1e629e9e2fc9b","user":{"login":"houtan1","id":19462543,"avatar_url":"https://avatars1.githubusercontent.com/u/19462543?v=3","gravatar_id":"","url":"https://api.github.com/users/houtan1","html_url":"https://github.com/houtan1","followers_url":"https://api.github.com/users/houtan1/followers","following_url":"https://api.github.com/users/houtan1/following{/other_user}","gists_url":"https://api.github.com/users/houtan1/gists{/gist_id}","starred_url":"https://api.github.com/users/houtan1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houtan1/subscriptions","organizations_url":"https://api.github.com/users/houtan1/orgs","repos_url":"https://api.github.com/users/houtan1/repos","events_url":"https://api.github.com/users/houtan1/events{/privacy}","received_events_url":"https://api.github.com/users/houtan1/received_events","type":"User","site_admin":false},"body":"Great commenting and references throughout.","created_at":"2017-03-31T03:10:55Z","updated_at":"2017-03-31T03:23:53Z","html_url":"https://github.com/trstephen/elec483/pull/9#discussion_r109080560","pull_request_url":"https://api.github.com/repos/trstephen/elec483/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/trstephen/elec483/pulls/comments/109080560"},"html":{"href":"https://github.com/trstephen/elec483/pull/9#discussion_r109080560"},"pull_request":{"href":"https://api.github.com/repos/trstephen/elec483/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/trstephen/elec483/pulls/9","id":113563706,"html_url":"https://github.com/trstephen/elec483/pull/9","diff_url":"https://github.com/trstephen/elec483/pull/9.diff","patch_url":"https://github.com/trstephen/elec483/pull/9.patch","issue_url":"https://api.github.com/repos/trstephen/elec483/issues/9","number":9,"state":"open","locked":false,"title":"Encode / Decode","user":{"login":"trstephen","id":6734837,"avatar_url":"https://avatars0.githubusercontent.com/u/6734837?v=3","gravatar_id":"","url":"https://api.github.com/users/trstephen","html_url":"https://github.com/trstephen","followers_url":"https://api.github.com/users/trstephen/followers","following_url":"https://api.github.com/users/trstephen/following{/other_user}","gists_url":"https://api.github.com/users/trstephen/gists{/gist_id}","starred_url":"https://api.github.com/users/trstephen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trstephen/subscriptions","organizations_url":"https://api.github.com/users/trstephen/orgs","repos_url":"https://api.github.com/users/trstephen/repos","events_url":"https://api.github.com/users/trstephen/events{/privacy}","received_events_url":"https://api.github.com/users/trstephen/received_events","type":"User","site_admin":false},"body":"Done done done! ✅ ","created_at":"2017-03-31T02:40:11Z","updated_at":"2017-03-31T03:23:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"54bed730346e6f47fecd7a20aad2ba2bd3e102b9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/trstephen/elec483/pulls/9/commits","review_comments_url":"https://api.github.com/repos/trstephen/elec483/pulls/9/comments","review_comment_url":"https://api.github.com/repos/trstephen/elec483/pulls/comments{/number}","comments_url":"https://api.github.com/repos/trstephen/elec483/issues/9/comments","statuses_url":"https://api.github.com/repos/trstephen/elec483/statuses/a9fa72302e2ca0cad7193a4fe1a1e629e9e2fc9b","head":{"label":"trstephen:trs/encode-decode","ref":"trs/encode-decode","sha":"a9fa72302e2ca0cad7193a4fe1a1e629e9e2fc9b","user":{"login":"trstephen","id":6734837,"avatar_url":"https://avatars0.githubusercontent.com/u/6734837?v=3","gravatar_id":"","url":"https://api.github.com/users/trstephen","html_url":"https://github.com/trstephen","followers_url":"https://api.github.com/users/trstephen/followers","following_url":"https://api.github.com/users/trstephen/following{/other_user}","gists_url":"https://api.github.com/users/trstephen/gists{/gist_id}","starred_url":"https://api.github.com/users/trstephen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trstephen/subscriptions","organizations_url":"https://api.github.com/users/trstephen/orgs","repos_url":"https://api.github.com/users/trstephen/repos","events_url":"https://api.github.com/users/trstephen/events{/privacy}","received_events_url":"https://api.github.com/users/trstephen/received_events","type":"User","site_admin":false},"repo":{"id":84859093,"name":"elec483","full_name":"trstephen/elec483","owner":{"login":"trstephen","id":6734837,"avatar_url":"https://avatars0.githubusercontent.com/u/6734837?v=3","gravatar_id":"","url":"https://api.github.com/users/trstephen","html_url":"https://github.com/trstephen","followers_url":"https://api.github.com/users/trstephen/followers","following_url":"https://api.github.com/users/trstephen/following{/other_user}","gists_url":"https://api.github.com/users/trstephen/gists{/gist_id}","starred_url":"https://api.github.com/users/trstephen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trstephen/subscriptions","organizations_url":"https://api.github.com/users/trstephen/orgs","repos_url":"https://api.github.com/users/trstephen/repos","events_url":"https://api.github.com/users/trstephen/events{/privacy}","received_events_url":"https://api.github.com/users/trstephen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/trstephen/elec483","description":"Project for ELEC 483: Digital Video Processing","fork":false,"url":"https://api.github.com/repos/trstephen/elec483","forks_url":"https://api.github.com/repos/trstephen/elec483/forks","keys_url":"https://api.github.com/repos/trstephen/elec483/keys{/key_id}","collaborators_url":"https://api.github.com/repos/trstephen/elec483/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/trstephen/elec483/teams","hooks_url":"https://api.github.com/repos/trstephen/elec483/hooks","issue_events_url":"https://api.github.com/repos/trstephen/elec483/issues/events{/number}","events_url":"https://api.github.com/repos/trstephen/elec483/events","assignees_url":"https://api.github.com/repos/trstephen/elec483/assignees{/user}","branches_url":"https://api.github.com/repos/trstephen/elec483/branches{/branch}","tags_url":"https://api.github.com/repos/trstephen/elec483/tags","blobs_url":"https://api.github.com/repos/trstephen/elec483/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/trstephen/elec483/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/trstephen/elec483/git/refs{/sha}","trees_url":"https://api.github.com/repos/trstephen/elec483/git/trees{/sha}","statuses_url":"https://api.github.com/repos/trstephen/elec483/statuses/{sha}","languages_url":"https://api.github.com/repos/trstephen/elec483/languages","stargazers_url":"https://api.github.com/repos/trstephen/elec483/stargazers","contributors_url":"https://api.github.com/repos/trstephen/elec483/contributors","subscribers_url":"https://api.github.com/repos/trstephen/elec483/subscribers","subscription_url":"https://api.github.com/repos/trstephen/elec483/subscription","commits_url":"https://api.github.com/repos/trstephen/elec483/commits{/sha}","git_commits_url":"https://api.github.com/repos/trstephen/elec483/git/commits{/sha}","comments_url":"https://api.github.com/repos/trstephen/elec483/comments{/number}","issue_comment_url":"https://api.github.com/repos/trstephen/elec483/issues/comments{/number}","contents_url":"https://api.github.com/repos/trstephen/elec483/contents/{+path}","compare_url":"https://api.github.com/repos/trstephen/elec483/compare/{base}...{head}","merges_url":"https://api.github.com/repos/trstephen/elec483/merges","archive_url":"https://api.github.com/repos/trstephen/elec483/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/trstephen/elec483/downloads","issues_url":"https://api.github.com/repos/trstephen/elec483/issues{/number}","pulls_url":"https://api.github.com/repos/trstephen/elec483/pulls{/number}","milestones_url":"https://api.github.com/repos/trstephen/elec483/milestones{/number}","notifications_url":"https://api.github.com/repos/trstephen/elec483/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/trstephen/elec483/labels{/name}","releases_url":"https://api.github.com/repos/trstephen/elec483/releases{/id}","deployments_url":"https://api.github.com/repos/trstephen/elec483/deployments","created_at":"2017-03-13T18:09:46Z","updated_at":"2017-03-14T01:07:23Z","pushed_at":"2017-03-31T02:40:11Z","git_url":"git://github.com/trstephen/elec483.git","ssh_url":"git@github.com:trstephen/elec483.git","clone_url":"https://github.com/trstephen/elec483.git","svn_url":"https://github.com/trstephen/elec483","homepage":"","size":5321,"stargazers_count":0,"watchers_count":0,"language":"Matlab","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"master"}},"base":{"label":"trstephen:master","ref":"master","sha":"b444520cee00c7f0763075ed8d26259b4d19fb50","user":{"login":"trstephen","id":6734837,"avatar_url":"https://avatars0.githubusercontent.com/u/6734837?v=3","gravatar_id":"","url":"https://api.github.com/users/trstephen","html_url":"https://github.com/trstephen","followers_url":"https://api.github.com/users/trstephen/followers","following_url":"https://api.github.com/users/trstephen/following{/other_user}","gists_url":"https://api.github.com/users/trstephen/gists{/gist_id}","starred_url":"https://api.github.com/users/trstephen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trstephen/subscriptions","organizations_url":"https://api.github.com/users/trstephen/orgs","repos_url":"https://api.github.com/users/trstephen/repos","events_url":"https://api.github.com/users/trstephen/events{/privacy}","received_events_url":"https://api.github.com/users/trstephen/received_events","type":"User","site_admin":false},"repo":{"id":84859093,"name":"elec483","full_name":"trstephen/elec483","owner":{"login":"trstephen","id":6734837,"avatar_url":"https://avatars0.githubusercontent.com/u/6734837?v=3","gravatar_id":"","url":"https://api.github.com/users/trstephen","html_url":"https://github.com/trstephen","followers_url":"https://api.github.com/users/trstephen/followers","following_url":"https://api.github.com/users/trstephen/following{/other_user}","gists_url":"https://api.github.com/users/trstephen/gists{/gist_id}","starred_url":"https://api.github.com/users/trstephen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trstephen/subscriptions","organizations_url":"https://api.github.com/users/trstephen/orgs","repos_url":"https://api.github.com/users/trstephen/repos","events_url":"https://api.github.com/users/trstephen/events{/privacy}","received_events_url":"https://api.github.com/users/trstephen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/trstephen/elec483","description":"Project for ELEC 483: Digital Video Processing","fork":false,"url":"https://api.github.com/repos/trstephen/elec483","forks_url":"https://api.github.com/repos/trstephen/elec483/forks","keys_url":"https://api.github.com/repos/trstephen/elec483/keys{/key_id}","collaborators_url":"https://api.github.com/repos/trstephen/elec483/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/trstephen/elec483/teams","hooks_url":"https://api.github.com/repos/trstephen/elec483/hooks","issue_events_url":"https://api.github.com/repos/trstephen/elec483/issues/events{/number}","events_url":"https://api.github.com/repos/trstephen/elec483/events","assignees_url":"https://api.github.com/repos/trstephen/elec483/assignees{/user}","branches_url":"https://api.github.com/repos/trstephen/elec483/branches{/branch}","tags_url":"https://api.github.com/repos/trstephen/elec483/tags","blobs_url":"https://api.github.com/repos/trstephen/elec483/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/trstephen/elec483/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/trstephen/elec483/git/refs{/sha}","trees_url":"https://api.github.com/repos/trstephen/elec483/git/trees{/sha}","statuses_url":"https://api.github.com/repos/trstephen/elec483/statuses/{sha}","languages_url":"https://api.github.com/repos/trstephen/elec483/languages","stargazers_url":"https://api.github.com/repos/trstephen/elec483/stargazers","contributors_url":"https://api.github.com/repos/trstephen/elec483/contributors","subscribers_url":"https://api.github.com/repos/trstephen/elec483/subscribers","subscription_url":"https://api.github.com/repos/trstephen/elec483/subscription","commits_url":"https://api.github.com/repos/trstephen/elec483/commits{/sha}","git_commits_url":"https://api.github.com/repos/trstephen/elec483/git/commits{/sha}","comments_url":"https://api.github.com/repos/trstephen/elec483/comments{/number}","issue_comment_url":"https://api.github.com/repos/trstephen/elec483/issues/comments{/number}","contents_url":"https://api.github.com/repos/trstephen/elec483/contents/{+path}","compare_url":"https://api.github.com/repos/trstephen/elec483/compare/{base}...{head}","merges_url":"https://api.github.com/repos/trstephen/elec483/merges","archive_url":"https://api.github.com/repos/trstephen/elec483/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/trstephen/elec483/downloads","issues_url":"https://api.github.com/repos/trstephen/elec483/issues{/number}","pulls_url":"https://api.github.com/repos/trstephen/elec483/pulls{/number}","milestones_url":"https://api.github.com/repos/trstephen/elec483/milestones{/number}","notifications_url":"https://api.github.com/repos/trstephen/elec483/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/trstephen/elec483/labels{/name}","releases_url":"https://api.github.com/repos/trstephen/elec483/releases{/id}","deployments_url":"https://api.github.com/repos/trstephen/elec483/deployments","created_at":"2017-03-13T18:09:46Z","updated_at":"2017-03-14T01:07:23Z","pushed_at":"2017-03-31T02:40:11Z","git_url":"git://github.com/trstephen/elec483.git","ssh_url":"git@github.com:trstephen/elec483.git","clone_url":"https://github.com/trstephen/elec483.git","svn_url":"https://github.com/trstephen/elec483","homepage":"","size":5321,"stargazers_count":0,"watchers_count":0,"language":"Matlab","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/trstephen/elec483/pulls/9"},"html":{"href":"https://github.com/trstephen/elec483/pull/9"},"issue":{"href":"https://api.github.com/repos/trstephen/elec483/issues/9"},"comments":{"href":"https://api.github.com/repos/trstephen/elec483/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/trstephen/elec483/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/trstephen/elec483/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/trstephen/elec483/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/trstephen/elec483/statuses/a9fa72302e2ca0cad7193a4fe1a1e629e9e2fc9b"}}}}
{"actor":{"display_login":"houtan1"}}